<?php
$blog_args = array(
'post_type' => 'post',
'cat' => 48, //chose one category
'posts_per_page' => 10,
'order' => 'DATE',
'orderby' => 'DESC',
'tax_query' => $tax_query,
'paged' => $paged
);
$blog_query = new WP_Query($blog_args);
?>
]]>remove_action( 'twentytwelve_content_nav', 'next_posts_link');
remove_action( 'twentytwelve_content_nav', 'previous_posts_link');
It works fine, and the page loads as it should but there is an error message at the bottom of the
page
Fatal error: Call to undefined function twentytwelve_content_nav() in ……./themes/2012-
Child/category.php on line 34
Fine, I thought I can fix that by commenting out the line in Category.php..
that’s this line…
twentytwelve_content_nav( ‘nav-below’ ); ?>
Could I hell!
I then get…
Parse error: syntax error, unexpected ‘<‘
this particular symbol is not shown in the Codex for some reason, and not being a coder I don’t know what it means.
so I tried removing everything else below it
Nope,
I even tried making the deleting the whole Category.php child file
Nope, that breaks the site.
So my question…
How do I remove the twentytwelve_content_nav( ‘nav-below’ ); ?> call from the child Category.php
file?
BTW
I don’t ask for help unless desperate, I have looked at over 300 web pages to solve this problem,
Nope!
Theme is 2012 with child
Here is the complete template contents for category.php (child)
<?php
/**
* The template for displaying Category pages - 2012 CHILD THEME
*/
get_header(); ?>
<section id="primary" class="site-content">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="page-title">
<span><?php single_cat_title( '', false ); ?></span>
</h1>
<?php if ( category_description() ) : // Show an optional category description ?>
<div class="archive-meta"><?php echo category_description(); ?></div>
<?php endif; ?>
</header><!-- .archive-header -->
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
/* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
twentytwelve_content_nav( 'nav-below' ); ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
]]>p.s. I have also used other tags like ‘<?php posts_nav_link(); ?>’.
]]>I’ve been struggling through information I’ve found online to no avail for the last few days. Anyone know how to do this? Thanks so much.
]]>– note that the next posts link is formatted to appear as a down-arrow.
– note also that the layout of the search results page looks odd (doesn’t display ‘search results for’ at the top) because I am using the same template as category.php to work out why it isn’t working.
Can anyone suggest why next_posts_link displays in category.php but not in search.php?
]]>When we are using posts_per_page in query_posts or WP_query, the navigation doesn’t match the request number of post, but based on the setting reading number of posts. This is kind of annoying when we using difference of number of post depending of the template page used.
To prevent this problem I am using that for now:
function custom_posts_per_page( $query ) {
if ( is_category(4) ) {
set_query_var('posts_per_page', 5);
}
}
add_action( 'pre_get_posts', 'custom_posts_per_page' );
Anyway, thank you for your work on WordPress, this is a great platform to work on.
]]>I’ve got a piece of standard code which allows to jump into older posts. This used to be workable but probably after upgrading to WP 4.0 it’s no longer works correctly. When clicking on the link it shows the same page but link looks ok, like this one https://mjstore.ru/news/page/2/
<div class=”navigation navbot”>
<div class=”alignleft”><?php previous_posts_link(‘< Посмотреть новые записи’) ?></div>
<div class=”alignright”><?php next_posts_link(‘Посмотреть старые записи >’) ?></div>
</div>
If there something changed to the way how WP requests old posts from database?
]]>this code works:
<?php next_posts_link('<img src="https://www.joelcormack.com/mxmg.com/wordpress/wp-content/themes/marinelogix-light-and-dark/images/next.png" />'); ?>
this code doesn’t:
<?php previous_posts_link('<img src="<?php bloginfo('template_directory'); ?>/images/previous.png" />'); ?>
I’ve searched these forums but can’t seem to find a way of properly pulling images from within the next and previous posts links. Is there a way it can be done, without hard coding?
My text editor doesn’t like like the latter code either and says its a parse error.
any help would be most appreciated.
]]>I see that, when the visitor, over and over, selects “Older post”, after the fifth post, the display returns to the first (i.e., most recent) post. There appears to be no way to cycle backward in time beyond five posts.
My blog displays one post per screen. It’s a simple-minded writing blog with a one-file template based on Jeff Starr’s H5, (Well, 3 files if one includes the requisite functions.php and symbolic CSS—the template actually links to site CSS elsewhere.)
The site is at apfwebs(dot)com
I have wp-super-cache, and have ensured the cache is refreshed… Any other advice (blog settings, etc.) would be most appreciated.
]]>My custom template uses next_posts_link (and prev_posts_link) in its nav section. These links, as you may know, do not include “rel=next” and “rel=prev” text. I am under the impression that, if I use next_post_link (and prev_post_link) in a proper manner, I may include such text in my links. However, when I place these items in my template, i receive a PHP error claiming these functions are not available.
Does this mean, simply, that I must rewrite my template and reload it instead of editing it in place (Appearance==> Editor==> Main Template) online?
Simple advice requested.
]]>