New answers tagged

0

I found the following plugin that shows the results on many phrases of the same post: https://scott.yang.id.au/pages/search-excerpt.html


0

You may need to add this to your query_posts() call 'order' => 'ASC' so it should look like this: query_posts( array( 'post__in' => $top_ideas, 'orderby' => 'post__in', 'order' => 'ASC' ) ); Hope this helps!


0

You have this code: elseif (17 < $count && $count <= 27 && $paged === 1) : if ($count === 10) echo 'DIV/CONTENT BEFORE THE NEXT 10 POST GOES HERE'; The first conditional fails when 10 === $count and so the second conditional can never succeed. As your while loop executes (in a structure that WordPress calls The Loop, calling ...


0

I think you can simply use: post_class( 0 === $featured_posts->current_post ? 'first' : '' ); to add the first class directly within your template code, instead of applying the post_class filter.


0

Turns out that it is possible to run a WP_Query inside a pre_get_posts action keeping in mind two simple principles: pre_get_posts action will alter every query that you make, so you need to contain its action specifying which queries you need to alter. In this case, this containment is done with this line: if ( is_admin() and !current_user_can('...


0

You can use WP_Query to query posts from Date A to Date B, here are all Date Parameters for the WP_Query object : //////Date Parameters - Show posts associated with a certain time and date period. //http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters 'year' => 2014, //(int) - 4 digit year (e.g. 2011). '...


0

The is_category function checks the queried object. Since this is in pre_get_posts, the query has not happened yet. Check the other parameters to find if the query is going to be for cat 5, not if the results are for cat 5. Try ->get('cat').


0

You have two options; either bake into the theme (functions.php) or write a simple plugin that auto-creates the post based on hooking into after new site (blog) creation: https://codex.wordpress.org/Plugin_API/Action_Reference/wpmu_new_blog Use the insert post function to do the creation: https://developer.wordpress.org/reference/functions/wp_insert_post/ ...



Top 50 recent answers are included