• Resolved Brian

    (@gophumek)


    I’ve added text to one category via placing some code on my archives.php page. Now I need to make sure that text doesn’t show up on page 2 and following of that category. I found this code wordpress says to add, but I’m not sure where to place it or how to do this.

    <?php if ( $paged < 2 ) : ?>
    <p>Text for first page of Category archive.</p>
    <?php else : ?>
    <p>Text for subsequent pages of Category.
    Can be left out.</p>
    <?php endif; ?>

    I had tried playing with this and added the code just above the following code which allows me to add text to a specific category page:

    <?php if (is_category('Category A')) : ?>
    <p>This is the text to describe category A</p>
    <?php elseif (is_category('Category B')) : ?>
    <p>This is the text to describe category B</p>
    <?php else : ?>
    <p>This is some generic text to describe all other category pages,
    I could be left blank</p>
    <?php endif; ?>

    The only thing that happened was that the text in the first code showed up on each category page.

    I hope I didn’t confuse everyone. Any help would be greatly appreciated.

    Thanks,
    Brian

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Brian

    (@gophumek)

    Oh yes, the page I’m trying to do this on is:

    https://www.gotinterviews.com/category/travelviews/

    Thanks

    First. create a Child Theme.

    Then review Category Templates.

    Create category-travelviews.php in your Child Theme as instructed (Copy and rename category.php, edit, put in Child Theme folder)

    Thread Starter Brian

    (@gophumek)

    Thank you so much for your quick reply. That was awesome of you.

    You’ve encouraged me to finally make a child theme, something I’ve never done.

    I saw the post on how to do it, but if you can answer one more question.

    I’d like to know if since I’ve made changes to the parent theme, changes I definitely want to keep. There’s not many, and I may have forgotten exactly what changes I’ve made. How do I keep all of those changes inside of a new child theme? Once I activate the child theme, I do not want anything changed from how the site appears now.

    Could I just create files for every file in my parent theme and copy the exact files I currently have, including the ones I have modified?

    Then just add that category-travelviews.php.

    Once I edit category-travelviews.php, I’d just put my text I want to show up as an intro to that category and then when I click on older posts (page 2) that intro won’t appear.

    I hope I have this all understood correctly.

    Again, thanks for your help.

    Brian

    It took me way longer than 14 minutes to be well exercised in such…please study my links and their links and report back. We will not require a test at that time, but will have confidence you at least had ample time to review the material. ??

    Thread Starter Brian

    (@gophumek)

    I’ve read through the child them page. I would go on to read the other links at the bottom of that page. However, I’m overwhelmed already. I see I can’t copy functions php though.

    I honestly have little idea how to do this and do not want my site messed up.

    I think I’ll leave it as is. Or try to find a way to use the parent theme and just use the info provided on the category template codex here on WordPress.

    If I can ever figure out how to use that code provided there, then that will fix my problem. But of course, it’s not the best way to do what I want. However, that was my original question. I hope someone will be able to help me understand where to put that code.

    But thank you for the encouragement to create a child theme. When I’m not such a novice, I’ll try to create a child theme.

    Thanks,
    Brian

    Thread Starter Brian

    (@gophumek)

    resolved

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Text on Category pages’ is closed to new replies.