Avada Forums Community Forum Previous/Next

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • magdalenaszweda
    Participant
    Post count: 3

    Hi,
    Is it possible to put Previous/Next line at th end of the post, after all photos and text?
    I will be greatfull for any idea 🙂
    Thx!

    elvinatt
    Participant
    Post count: 4

    I am trying to do the same, did you have any luck?
    Thank you

    elvinatt
    Participant
    Post count: 4

    Thanks to Avada support I had this answer: posting it here for future reference.

    We would need a child theme which would need the following function in functions.php

    function my_custom_function_for_avada() {
    ?>

    <?php $post_pagination = get_post_meta( $post->ID, ‘pyre_post_pagination’, true ); ?>
    <?php if ( ( Avada()->settings->get( ‘blog_pn_nav’ ) && ‘no’ !== $post_pagination ) || ( ! Avada()->settings->get( ‘blog_pn_nav’ ) && ‘yes’ === $post_pagination ) ) : ?>
    <div class=”single-navigation clearfix”>
    <?php previous_post_link( ‘%link’, esc_attr__( ‘Previous’, ‘Avada’ ) ); ?>
    <?php next_post_link( ‘%link’, esc_attr__( ‘Next’, ‘Avada’ ) ); ?>
    </div>
    <?php endif; ?>

    <?php
    }
    add_filter( ‘avada_after_additional_post_content’, ‘my_custom_function_for_avada’ );

    Post that we would need to use the following custom CSS by going to WordPress admin panel dashboard —-> Avada —> Theme Options —-> Custom CSS

    .single-post .post {
    display: flex;
    flex-direction: column;
    }

    .fusion-sharing-box.fusion-single-sharing-box.share-box, .about-author, section.related-posts.single-related-posts, div#respond {
    order: 2;
    }

    .single-post section#content > .single-navigation.clearfix {
    display: none !important;
    }

    magdalenaszweda
    Participant
    Post count: 3

    Thank You for information.
    Unfortunetly, i havent found the solution till now, so i just put the button ‘previous’ and ‘next’ at the end of the post 🙂

    tpf27
    Participant
    Post count: 2

    Just an update to the code snippet that @elvinatt posted, this works great but $post isn’t defined so $post->ID will throw an error. Try changing it to use get_the_ID() like this:

    function put_the_single_post_navigation_at_the_bottom_of_the_post() {
    $post_pagination = get_post_meta( get_the_ID(), ‘pyre_post_pagination’, true );
    if ( ( Avada()->settings->get( ‘blog_pn_nav’ ) && ‘no’ !== $post_pagination ) || ( ! Avada()->settings->get( ‘blog_pn_nav’ ) && ‘yes’ === $post_pagination ) ) : ?>
    <div class=”single-navigation clearfix”>
    <?php previous_post_link( ‘%link’, esc_attr__( ‘Previous’, ‘Avada’ ) ); ?>
    <?php next_post_link( ‘%link’, esc_attr__( ‘Next’, ‘Avada’ ) ); ?>
    </div>
    <?php endif;
    }
    add_filter( ‘avada_after_additional_post_content’, ‘put_the_single_post_navigation_at_the_bottom_of_the_post’ );

    LouisePriceKelly
    Participant
    Post count: 2

    Hi – thank you so much for commenting on this – this is something I’m trying to figure out for my daughter’s webcomic site. I tried to use the updated code but I think the last line of the code is still causing errors – when I tried to use it, I got these errors:

    Warning: Use of undefined constant ‘avada_after_additional_post_content’ – assumed ‘‘avada_after_additional_post_content’’ (this will throw an Error in a future version of PHP) in /home/crm4good/staging/1/wp-content/themes/Avada-child/functions.php on line 40

    Warning: Use of undefined constant ‘put_the_single_post_navigation_at_the_bottom_of_the_post’ – assumed ‘‘put_the_single_post_navigation_at_the_bottom_of_the_post’’ (this will throw an Error in a future version of PHP) in /home/crm4good/staging/1/wp-content/themes/Avada-child/functions.php on line 40

    Do you have any advice on how to fix this? Thanks in advance!

    marklchaves
    Participant
    Post count: 873

    Hi Everyone,

    Ya, I really don’t care for the WordPress pagination nav design for a single post/page works. As you can see, it looks like a lot of gory code-slinging just to move the Previous and Next arrows somewhere else on the page. Ugh.

    Anyway, here’s an alternative if you want something more simple. You’ll still need to get into the code, but I find this a bit easier. Caution, you have to be comfortable editing PHP to do this. If you are not, I’d consult a professional or leave it alone.

    1. You’ll need File Manager or FTP access to your WordPress install.
    2. Go into your Avada theme folder.
    3. Copy the single.php file to your child theme folder.
    4. Open your child theme’s single.php file in a text editor or code editor (preferred).
    5. Search on previous_post_link.
    6. Cut the entire if code block where you found the previous_post_link.
    7. Paste the if code bock further down to where you want it. I chose to place it just under the Author’s details which is just above the related posts in my instance of Avada.

    Here are some screen captures of how I did it.

    Search for previous_post_link in Avada Child/single.php
    https://www.dropbox.com/s/tla06045g8gvyu9/avada-single-php-pagination-top.png?dl=0

    Cut/paste to below the Author details box
    https://www.dropbox.com/s/cvrjnmi8ajr0iw6/avada-single-php-pagination-after-author.png?dl=0

    End result
    https://www.dropbox.com/s/bdhcazjmmzysqci/single-page-nav-after-author.png?dl=0

    BTW, if you are successful with this, then you can use something like WP-PageNavi plugin to add a fancier style to your pagination code. I haven’t used this plugin yet, but I’ve seen it referred to on Elegant Theme’s blog.

    Good luck!

    LouisePriceKelly
    Participant
    Post count: 2

    Hi – thank you! My apologies – I actually did figure this out and now have the previous – next link working the way I want – at least on the single post pages. But for some weird reason what displays when I select ‘display recent posts’ as the home page, the layout of THAT page is different than the layout when I go to an individual post. It must be a different template that controls that. Very frustrating.

    And I hear you about ‘next-previous’ being out of date but this site is a webcomic and apparently that is pretty common navigation for that particular type of content.

    Thanks for your help! I am going to submit a ticket to Avada to find out what template / php file controls the way a post displays when you select ‘most recent posts’ for your home page settings (and/or the layout for the blog element – in both cases the layout isn’t the same as a single post). I’m hoping I can just pop the same next / previous code into that template. And FYI – in my case, the pagination options provided with Avada’s blog element don’t work because they consider ‘next’ to be the post that was published EARLIER and Previous shows the post that was published LATER – which is the opposite of how a webcomic needs to work. I’ll try to remember to post when I get this figured out so others can benefit from this…

    mariashin
    Participant
    Post count: 2

    Hello! If anybody knows how to force Avada to post next/previous product link for current category on single product page – please, help! Thank you.
    P.S.
    It is funny, but the free Storefront theme is doing this by default.

    coolartwork
    Participant
    Post count: 2

    have found the solution for yours problem? Because i have it too.

    nouraie
    Participant
    Post count: 2

    Have you found a solution to this ? i tried a few codes, but avada seems to block it from working in single procduct page.

    threegtelecom
    Participant
    Post count: 1

    i am also facing this problem.plz avada theme developer fix it.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.