How to get the posts that my following users are liked?
How to get the posts that my following users are liked?
How to get the posts that my following users are liked?
Your code: $the_query = new WP_Query( array( ‘posts_per_page’ =>’2′, ‘paged’ => $paged )); Replace With this: global $wp_query; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array_merge( $wp_query->query, array( ‘posts_per_page’ =>’2′,’paged’ => $paged ) ); query_posts( $args ); NOTE: This code is not tested so first backup your page.
Easier way would be to use a $_GET parameter (which don’t change the autogenerated canonical address wordpress uses) and the content_pagination filter like this: add_filter( ‘content_pagination’, function($pages){ if ( in_the_loop() && (isset($_GET[‘onepage’]) ){ $pages = [ join( ”, $pages ) ]; } return $pages; } ); Happy Coding.
If there is only 1 post showing up in your page, you could use the the_title() filter to hide the title. The simplest way would be this: function hide_my_title( $title, $id = null ) { if ( is_single( 2 ) ) { return ”; } return $title; } add_filter( ‘the_title’, ‘hide_my_title’, 10, 2 ); This … Read more
The display of ‘things’ on your blog page is usually dependent on the theme. You can verify this by switching to one of the ‘twenty’ default themes and redisplay the page. If the title appears, then you have verified that the problem is a theme problem. If you verify a problem with the theme, then … Read more
Either there is some code missing above, or you’ve only posted part. It looks like you didn’t count within your loop. Try using: $count = $books->post_count; within your loop and then at the bottom just use: if($count > 6) { but that all needs to be within your loop (before the endwhile.) I don’t see … Read more
under settings – reading, set ‘blog pages show at most’ to 8 then use conditional statements based on the current post number in the loop; <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php //conditionally outputting the opening tags for the first section if( $wp_query->current_post == 0 ) { ?> <div class=”posts-wrap”> … Read more
You should be able to replace this section: $posts = get_posts( ‘numberposts=-1&post_status=publish&post_type=questionnaire’ ); $choices = array(); $choices[] = array(“text” => “Select Questionnaire”, “value” => “”); foreach ( $posts as $post ) { $choices[] = array( ‘text’ => $post->post_title, ‘value’ => $post->post_title ); } // update ‘Select a Post’ to whatever you’d like the instructive option … Read more
You can do this in two ways: (1) with two Pages and a CPT with no archive, or (2) with one Page and a CPT with an archive. Option 1 – two Pages: Create your two regular Pages, with “child-page” set as a child page of “landing-page”. When you register your CPT, set it to … Read more
you can add a parameter with a new rewrite rule like that : add_action(“init”, function () { add_rewrite_tag(“%countryName%”, “([^&]+)”); add_rewrite_rule( “^company/([^/]*)/country/([^/]*)/?” , ‘index.php?company=$matches[1]&countryName=$matches[2]’ , “top” ); }); After adding this code, flush the rewrite rules of WordPress. Then you can use URL like http://example.com/company/company-abc/country/UK And then in the template, you retrieve the parameter with get_query_var(“countryName”, … Read more