Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #639787

    erfekto
    Participant

    Hi, how I can put next prev button on blog entries?

    🙂

    #639835

    Christopher
    Moderator

    Hi there,

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Please add this in child theme’s functions.php file :

     function x_post_navigations () {
    previous_post_link( '<strong>%link</strong>','Previous' ); echo '|'; next_post_link( '<strong>%link</strong>','Next' );
    }
    
    add_action ('x_after_view_renew_content', 'x_post_navigations');
    add_action ('x_after_view_renew_content-audio', 'x_post_navigations');
    add_action ('x_after_view_renew_content-gallery', 'x_post_navigations');
    add_action ('x_after_view_renew_content-image', 'x_post_navigations');
    add_action ('x_after_view_renew_content-link', 'x_post_navigations');
    add_action ('x_after_view_renew_content-quote', 'x_post_navigations');
    add_action ('x_after_view_renew_content-video', 'x_post_navigations');

    Hope it helps.

    #640038

    erfekto
    Participant

    Well, but is this happening

    http://ebweb.es/blog/

    #640121

    Darshana
    Moderator

    Hi there,

    Do you want to add that option in the main Blog index page or Single Blog Posts? Please refer to the following implementation here (https://community.theme.co/forums/topic/single-post-next-previous-arrow-navigation-like-ethos/#post-341795).

    Also you can use a plugin like WP Post Navigation (https://wordpress.org/plugins/wp-post-navigation/).

    Thanks!

    #640133

    erfekto
    Participant

    Thank you. Works

    🙂

    #640158

    Thai
    Moderator

    You’re most welcome 🙂

    #646330

    erfekto
    Participant

    Please to do the same in PORTFOLIO ITEMS?

    I’ve customized the file

    x/framework/functions/global/content.php

    ` $left_icon = ‘<i class=”x-icon-arrow-left” data-x-icon=””></i><span class=”flechaIzquierda”>  Anterior</span>’;
    $right_icon = ‘<span class=”flechaDerecha”>Siguiente &nbsp</span><i class=”x-icon-arrow-right” data-x-icon=””></i>’;`

    But in the functions.php file of my childtheme, it would be better.

    How I can do it like in the post?

    🙂

    #646651

    Jade
    Moderator

    Hi there,

    Please try to update the code to:

    add_action ('the_content', 'add_next_post_item_link' );
    
    function add_next_post_item_link ( $content ) {
    	if ( is_singular('post') || is_singular('x-portfolio') ) {
    		$next_name = "Next Post <i class=\"x-icon-chevron-right\"></i>";
    		$prev_name = "<i class=\"x-icon-chevron-left\"></i> Previous Post";
    		$next_link = get_next_post() ? '<a style="float: left;" href="' . get_permalink( get_next_post()->ID ) . '">' . $prev_name . '</a>' : '';
    		$prev_link = get_previous_post() ? '<a style="float: right;" href="' . get_permalink( get_previous_post()->ID ) . '">' . $next_name . '</a>' : '';
    		$posts = '<div class="wp-post-navigation-next">'.$next_link.$prev_link.'</div>';
    		return $content . $posts;
    	} else {
    		return $content;
    	}
    }

    Let us know how it goes.

    #659752

    erfekto
    Participant

    Thanks, but I have not been able to test. In two or three days I will. Thank you

    🙂

    #659844

    Thai
    Moderator

    You’re most welcome 🙂

    Let us know how it goes!

    #675779

    erfekto
    Participant

    Thanks, WORKS
    🙂

    #675783

    Thai
    Moderator

    Glad it worked 🙂

    If you need anything else, please let us know.