posts

How to get Posts Greater Than X (ID) using get_posts

半城伤御伤魂 提交于 2019-12-04 09:14:41
$args = array('numberposts' => 10, 'tag' => 'my-tag', 'ID' => 555'); $posts = get_posts($args); I want to bring only 10 records from an specific tag and that the ID is less than a number. Is there any way to do this with the get_posts arguments? How can I specify Greater Than, Less Than or Not Like in the arguments array? Thanks... A nice solution if you want to get the posts with an ID lower than X: $post_ids = range(1, 555); $args = array('numberposts' => 10, 'tag' => 'my-tag', 'post__in' => $post_ids'); $posts = get_posts($args); props to girlieworks here: https://wordpress.org/support

How can I display posts from the other sites in a WordPress multisite setup?

为君一笑 提交于 2019-12-04 08:09:10
问题 I have a small network of sites setup with WordPress 3.0's multisite feature. I would like to create another site which pulls certain posts from the various other sites to display. This new 'hub' site would seem like its own separate site to the user (with domain mapping), but its content is coming from the posts from the other sites. How can I get posts from another site in a WordPress multisite setup? Can I query for posts based on the name of the site? The end result needs to be a

show only posts created in last week

…衆ロ難τιáo~ 提交于 2019-12-04 06:14:33
I want to be able to show posts and have them sorted by a couple criteria, first by the amount of votes they have on them and second by the date at which they were created. I don't want posts that are more than a week old being displayed so only posts in the last week. I tried doing this: <%= render @posts.sort_by { |post| post.votes.count if post.created_at < 1.week.ago.utc }.reverse %> but it gave me an error of comparison of NilClass with 2 failed I know the code works by just sorting posts by vote count but I also want to limit time so could someone tell me how this can be done. I'm still

How can I display posts from the other sites in a WordPress multisite setup?

与世无争的帅哥 提交于 2019-12-02 22:24:13
I have a small network of sites setup with WordPress 3.0's multisite feature. I would like to create another site which pulls certain posts from the various other sites to display. This new 'hub' site would seem like its own separate site to the user (with domain mapping), but its content is coming from the posts from the other sites. How can I get posts from another site in a WordPress multisite setup? Can I query for posts based on the name of the site? The end result needs to be a collection of posts from the different sites sorted by date. Thanks for your help. Oudin I had the similar

Combine two similar jQuery scripts into an if/then script

核能气质少年 提交于 2019-12-02 17:28:39
问题 I am trying to combine two jQuery loops, based on code from questions answered here, which remove images and iframes from WordPress posts and move them either to new divs or to new lists. My previous questions have sought to achieve each of these outcomes independently, but I now need to combine them in a single page, selecting which one to use based on the parent container. Specifically, I want the first script to run on all <section> containers apart from the one with the #clients ID. That

Display recent posts based on their category in Wordpress

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 12:54:33
问题 I use a template that generates thumbnails on the content.php page like so: <article <?php post_class('single-entry clearfix'); ?>> <?php // Test if post has a featured image if( has_post_thumbnail() ) { // Get resize and show featured image : refer to functions/img_defaults.php for default values $wpex_entry_img = aq_resize( wp_get_attachment_url( get_post_thumbnail_id(), 'full' ), wpex_img( 'blog_entry_width' ), wpex_img( 'blog_entry_height' ), wpex_img( 'blog_entry_crop' ) ); ?> <div class

Use jQuery to move WordPress post attachments to per-post dynamically-created lists?

痞子三分冷 提交于 2019-12-02 10:54:53
My goal is to strip the images and iframes out of WordPress posts (they are in .para divs) and move them to a <ul> above the post, just inside the local wrapper (.wrapper940). The jQuery below works, but moves ALL image and iframes from all posts to a single new <ul> above the first post. Instead of this, I am trying to move the images and iframes PER POST to a new <ul> just inside the wrapper of each post. Here's the jQuery: jQuery("document").ready (function($){ var matchesEl = $(".para img, .para iframe"); if ( matchesEl.length > 0) { var newUl = $("<ul></ul>"); newUl.prependTo(matchesEl

How to hide all post's having certain labels on home page in Google Blogger?

女生的网名这么多〃 提交于 2019-12-02 08:54:55
问题 Let's consider, "Coding", "Technical","Diary" are some labels on blog and I do not want to display all "diary" label's posts on homepage (with my rest of the label post's) so what I want to do ? I want that XML code to hide post's with some labels from homepage ! [I search uncountable times same thing on search engines like yahoo,google,yandex,etc but I didn't got anything, [ hope blogger/xml community should help !] check image to view label 回答1: Search for the following emphasised (bold)

How to hide all post's having certain labels on home page in Google Blogger?

最后都变了- 提交于 2019-12-02 05:15:41
Let's consider, "Coding", "Technical","Diary" are some labels on blog and I do not want to display all "diary" label's posts on homepage (with my rest of the label post's) so what I want to do ? I want that XML code to hide post's with some labels from homepage ! [I search uncountable times same thing on search engines like yahoo,google,yandex,etc but I didn't got anything, [ hope blogger/xml community should help !] check image to view label Search for the following emphasised (bold) code in your template (Template - Edit HTML) .... <div class='post-outer'> <b:include data='post' name='post'/

If first post, style differently — Wordpress [closed]

三世轮回 提交于 2019-12-01 12:50:19
I need the first post that was ever posted to be styled differently. Is there a way that I can see if the post is first, and then change its contents? I currently have a div in all my posts. This needs to be replaced with different div . Apparently the following piece of code can help, but I'm not sure how to implemenet it: <?php if (have_posts()) : $postCount = 1; while (have_posts()) : $postCount++; ?> I'm new with WordPress so not entirely sure how this could work? Append following codes after yours: <?php if (have_posts()) : $postCount = 1; while (have_posts()) : $postCount++; ?> <?php if(