Black Friday sale! Get up to 25% off GP Premium! Learn more ➝

[Resolved] Category and Single posts using GP-Hooks

Home Forums Support [Resolved] Category and Single posts using GP-Hooks

Home Forums Support Category and Single posts using GP-Hooks

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #400104
    Joseph

    Because of the multiple categories that are within the site library, I am changing to a “Previous Page” button below the categories that I stacked using this CSS:

    footer.entry-meta .cat-links a,
    footer.entry-meta .tags-links a {
    display: block;
    float: left;
    clear: both;
    }
    .tags-links:before,
    .cat-links:before {
    content: ”;
    }

    That works fine.
    I am now using GP-Hooks to add the button for “Previous Page” right below the above CSS placing it in the After Content hook. It works fine also but the button appears in the main category page of which I don’t want to show so I changed the below code from “category” to “single” and the button still appears in the main category page.
    How can I prevent the button from showing on the main category page?

    <?php if ( is_single (”) ) : ?>
    <input type=”button” value=”Previous Page” onclick=”history.back(-1)” />
    <?php endif; ?>

    Any help is appreciated and thanks in advance.

    #400165
    Tom
    Lead Developer
    Lead Developer

    Try this instead:

    <?php if ( is_single() ) : ?>
        <input type="button" value="Previous Page" onclick="history.back(-1)" />
    <?php endif; ?>

    Let me know 🙂

    #400188
    Joseph

    That worked by removing the button from the main category page but it removed the single page link option as shown on the attached image.

    I used the Customizer for the color option but right below the categories, the button is blank and just shows Previous

    https://provinciewebdesign.com/support/PHP_single.png

    #400190
    Joseph
    #400349
    Tom
    Lead Developer
    Lead Developer

    Ah, just edited the code. Should be good to go now 🙂

    #400383
    Joseph

    Thank you Tom, That did the trick.

    Best regards

    #400399
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

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