next-post-link in same category

  • qazwsx

    #2781

    I found where to change in the loop.php file:

    <?php /* Posts navigation for single post pages, but not for Page post */ ?>
    <?php if ( is_single() && ! is_page() ) : ?>
    <div class="post-nav clearfix">
    <p id="previous"><?php previous_post_link('%link','%title',TRUE); ?></p>
    <p id="next-post"><?php next_post_link('%link','%title',TRUE); ?></p>
    <?php do_action('graphene_post_nav'); ?>
    </div>
    <?php endif; ?>

    The:

    php previous_post_link('%link','%title',TRUE);

    php next_post_link('%link','%title',TRUE);

    From:

    php previous_post_link();

    php next_post_link();

    But I only want to have this done on 1 category right now and not on every category and I do not want to change the loop.php file since updates will delete the changes.

    I don’t know what code to put in the loop-single.php child file to override this without it changing everything.

    I have not learned php yet 🙁

    Should this be done by making a loop-single.php or by adding a new post format to go with Standard, Status, Audio, Image, Video…

    Anonymous

    #21889

    Did you try next_post_link('Next post in category', TRUE);??

    Edit: Try this – next_post_link('%link', '%title', 'Next post in category', TRUE);

    qazwsx

    #21890

    Doing previous_post_link('%link','%title',TRUE) works great in the loop.php file.

    but I am not wanting to make the change in the loop.php file as it will be deleted during the next update of graphene.

    Mod

    Kenneth John Odle

    #21891

    You can try putting this in an action hook widget area (using the PHP Widget) and then use the Widget Logic plugin to make it show up just on posts in that category.

    If you can get this to work, please be sure to let us know because I think a lot of people are interested in this.

    qazwsx

    #21892

    Thank you Ken, I’ll try this over the weekend and let you know how it goes.

    Mod

    Kenneth John Odle

    #21893

    Thanks. Good luck!

    qazwsx

    #21894

    Ken,

    is

    <?php /* Posts navigation for single post pages, but not for Page post */ ?>
    <?php if ( is_single() && ! is_page() ) : ?>
    <div class="post-nav clearfix">
    <p id="previous"><?php previous_post_link('%link','%title',TRUE); ?></p>
    <p id="next-post"><?php next_post_link('%link','%title',TRUE); ?></p>
    <?php do_action('graphene_post_nav'); ?>
    </div>
    <?php endif; ?>

    the php for the widget? I can put plain text in the widget and it goes in the correct place on the page, but the php code doesn’t do anything.

    Mod

    Kenneth John Odle

    #21895

    qazwsx

    #21896

    I’ve got it working, just have to work on the style. But how would i remove the auto nav and have this there only?

    Mod

    Kenneth John Odle

    #21897

    have this there only?

    You’ve lost me here. Is it possible to see a link?

Viewing 10 posts - 1 through 10 (of 13 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!