admin管理员组文章数量:1333665
Hope it's okay to ask this question here - I'm not really a developer. I've been using Dox theme for a friend's website, and we are ready to go live over the weekend and the Theme developer isn't getting back very fast.
I've done some CSS customisations on the website, not a huge amount of changes on templates. We moved the website to the server we'd like to go live on, and had a few issues re PHP Version (the server was on ver 5.6 and it had the old website on, but some elements of the new site require ver 7.0+), changing the version seemed to have solved most of the problems, but this is something we both have only noticed today (may have happened before today) - the Prev/Post buttons on custom post types have disappeared - so that's the Projects and Events on the site, it continues to be working and fine for Posts.
Pages - Project: /
Post: /
I've tried disabling plugins, take out all custom CSS etc., didn't seem to have made any difference. And the navigation is enabled in the theme setting (in Customizer) Any advice much appreciated
The Navigation template:
<?php
/*
Navigation Prev/Next Template
*/
// Previous
$prev = get_previous_post();
// Next
$next = get_next_post();
if ( get_theme_mod( 'dox_post_single_navigation', 'enabled' ) != 'disabled' ) {
if ( $prev || $next ) { ?>
<div class="fy-post-nav">
<div class="fy-flex-container fy-flex-container-stretch fy-flex-gutter-large">
<div class="fy-flex-column-auto fy-flex-column-tablet-100">
<?php
if ( $prev ) {
$args = array(
'post_type' => get_post_type(),
'posts_per_page' => 1,
'p' => $prev->ID
);
$query = get_posts( $args );
foreach ( $query as $post ) {
setup_postdata( $post );
// Thumbnail
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), FORQY_THEME_SLUG . '-medium-fixed' );
// Thumbnail Image
$thumbnail_image = $thumbnail[0];
?>
<a href="<?php the_permalink(); ?>" class="fy-post-nav-post fy-post-prev">
<div class="fy-post-nav-header">
<?php esc_html_e( 'Previous', 'dox' ); ?>
<h3><span><?php the_title(); ?></span></h3>
</div>
</a>
<?php
wp_reset_postdata();
}
}
?>
</div>
<div class="fy-flex-column-auto fy-flex-column-tablet-100">
<?php
if ( $next ) {
$args = array(
'post_type' => get_post_type(),
'posts_per_page' => 1,
'p' => $next->ID
);
$query = get_posts( $args );
foreach ( $query as $post ) {
setup_postdata( $post );
// Thumbnail
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), FORQY_THEME_SLUG . '-medium-fixed' );
// Thumbnail Image
$thumbnail_image = $thumbnail[0];
?>
<a href="<?php the_permalink(); ?>" class="fy-post-nav-post fy-post-next">
<div class="fy-post-nav-header">
<?php esc_html_e( 'Next', 'dox' ); ?>
<h3><span><?php the_title(); ?></span></h3>
</div>
</a>
<?php
wp_reset_postdata();
}
}
?>
</div>
</div>
</div>
<?php }
}
Hope it's okay to ask this question here - I'm not really a developer. I've been using Dox theme for a friend's website, and we are ready to go live over the weekend and the Theme developer isn't getting back very fast.
I've done some CSS customisations on the website, not a huge amount of changes on templates. We moved the website to the server we'd like to go live on, and had a few issues re PHP Version (the server was on ver 5.6 and it had the old website on, but some elements of the new site require ver 7.0+), changing the version seemed to have solved most of the problems, but this is something we both have only noticed today (may have happened before today) - the Prev/Post buttons on custom post types have disappeared - so that's the Projects and Events on the site, it continues to be working and fine for Posts.
Pages - Project: https://fitkin/2020/project/veneer-2002-2003/
Post: https://fitkin/2020/unanswered-questions-about-bike-design/
I've tried disabling plugins, take out all custom CSS etc., didn't seem to have made any difference. And the navigation is enabled in the theme setting (in Customizer) Any advice much appreciated
The Navigation template:
<?php
/*
Navigation Prev/Next Template
*/
// Previous
$prev = get_previous_post();
// Next
$next = get_next_post();
if ( get_theme_mod( 'dox_post_single_navigation', 'enabled' ) != 'disabled' ) {
if ( $prev || $next ) { ?>
<div class="fy-post-nav">
<div class="fy-flex-container fy-flex-container-stretch fy-flex-gutter-large">
<div class="fy-flex-column-auto fy-flex-column-tablet-100">
<?php
if ( $prev ) {
$args = array(
'post_type' => get_post_type(),
'posts_per_page' => 1,
'p' => $prev->ID
);
$query = get_posts( $args );
foreach ( $query as $post ) {
setup_postdata( $post );
// Thumbnail
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), FORQY_THEME_SLUG . '-medium-fixed' );
// Thumbnail Image
$thumbnail_image = $thumbnail[0];
?>
<a href="<?php the_permalink(); ?>" class="fy-post-nav-post fy-post-prev">
<div class="fy-post-nav-header">
<?php esc_html_e( 'Previous', 'dox' ); ?>
<h3><span><?php the_title(); ?></span></h3>
</div>
</a>
<?php
wp_reset_postdata();
}
}
?>
</div>
<div class="fy-flex-column-auto fy-flex-column-tablet-100">
<?php
if ( $next ) {
$args = array(
'post_type' => get_post_type(),
'posts_per_page' => 1,
'p' => $next->ID
);
$query = get_posts( $args );
foreach ( $query as $post ) {
setup_postdata( $post );
// Thumbnail
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), FORQY_THEME_SLUG . '-medium-fixed' );
// Thumbnail Image
$thumbnail_image = $thumbnail[0];
?>
<a href="<?php the_permalink(); ?>" class="fy-post-nav-post fy-post-next">
<div class="fy-post-nav-header">
<?php esc_html_e( 'Next', 'dox' ); ?>
<h3><span><?php the_title(); ?></span></h3>
</div>
</a>
<?php
wp_reset_postdata();
}
}
?>
</div>
</div>
</div>
<?php }
}
Share
Improve this question
edited Jul 15, 2020 at 5:35
stealthyninja
1,1301 gold badge15 silver badges21 bronze badges
asked Jul 14, 2020 at 20:35
uchijjanguchijjang
11 bronze badge
1
|
1 Answer
Reset to default 0It's solved now - apparently, the theme developer didn't put in the call for the above template in the single project template in the latest update... I'm not sure if it's intentional or just an oversight, but it took a while to find the right template to change. All good now!
本文标签: PrevNext Navigation on Single Post Disappeared for Custom Post Type
版权声明:本文标题:PrevNext Navigation on Single Post Disappeared for Custom Post Type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742262044a2442693.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
$prev
and$next
variables are? If the prev and next links are not visible then perhaps that code isn't running at all because those variables aren't defined. Try changing those lines toif ( true) {
just to see what happens. – mozboz Commented Jul 14, 2020 at 20:56