Forum Replies Created
-
AuthorPosts
-
tkwingwingParticipant
I think the "remove_action( 'genesis_after_entry', 'genesis_adjacent_entry_nav' );"
is not really removing the default action, but what is the right way to remove it?
It is hard to find the solution...
tkwingwingParticipantI only found the genesis_adjacent_entry_nav function in post.php.
However, when I copied the following code to the child theme's functions.php, it has no effect on my website.
--------------------------------
remove_action( 'genesis_after_entry', 'genesis_adjacent_entry_nav' );add_action( 'genesis_after_entry', 'genesis_adjacent_entry_nav2' );
function genesis_adjacent_entry_nav2() {
if ( ! is_singular() || ! post_type_supports( get_post_type(), 'genesis-adjacent-entry-nav2' ) ) {
return;
}genesis_markup(
[
'open' => '<div %s>',
'context' => 'adjacent-entry-pagination',
]
);$next_post_text = '<span class="adjacent-post-link">%title </span>';
if ( genesis_a11y() ) {
$next_post_text = '<span class="screen-reader-text">' . esc_html__( 'Next Post:', 'genesis' ) . ' </span>' . $next_post_text;
}
genesis_markup(
[
'open' => '<div %s>',
'context' => 'pagination-next',
'content' => get_next_post_link( '%link', $next_post_text ),
'close' => '</div>',
]
);$previous_post_text = '<span class="adjacent-post-link"> %title</span>';
if ( genesis_a11y() ) {
$previous_post_text = '<span class="screen-reader-text">' . esc_html__( 'Previous Post:', 'genesis' ) . ' </span>' . $previous_post_text;
}
genesis_markup(
[
'open' => '<div %s>',
'context' => 'pagination-previous',
'content' => get_previous_post_link( '%link', $previous_post_text ),
'close' => '</div>',
]
);genesis_markup(
[
'close' => '</div>',
'context' => 'adjacent-entry-pagination',
]
);}
/**
* Helper function to display adjacent entry navigation on single posts. Must be hooked togenesis_after_entry
at priority 10 or earlier to work properly.
*
* @since 1.5.1
*/
function genesis_prev_next_post_nav2() {add_post_type_support( 'post', 'genesis-adjacent-entry-nav2' );
}
tkwingwingParticipanthi, Thanks for the reply,
I am new to Genesis and have no idea about coding, would you mind giving me more hints or samples to follow? Much appreciate. thanks
-
AuthorPosts