Adv Serach: changing CPT changes the page id?

This topic contains 4 replies, has 3 voices, and was last updated by  ian bran 7 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #419318

    ian bran
    Expired Member
    Post count: 122

    Hello,
    I have a span that I wish it to appear only in the homepage, like this:

    `<div class=”clearfix geodir-loc-bar-in”>
    <div class=”geodir-search”>

    <?php if ( is_front_page() ) : ?>
    <span class=”example”>example text</span>
    <?php endif ?>`

    it works ok, but the span disappears when in search filter I select a different CPT from the dropdown. The page id remains the same so I don’t understand :S

    Someone could explain me a possible reason for this?

    *other solution would be hiding the span on pages that are not the homepage

    Thank you!

    #419342

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    Where are you adding this custom code?

    I will flag your question for the developers in case they have an easy fix. Please reply with site details and a URL so they can look into it.

    #419347

    ian bran
    Expired Member
    Post count: 122
    This reply has been marked as private.
    #419462

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    When you change the CPT it grabs the HTML for the search form via ajax, which it will not think is the home page, so it wont show that text.

    Stiofan

    #419598

    ian bran
    Expired Member
    Post count: 122

    Thank you Stiofan.

    So I guess hiding it with CSS is my best bet.
    The problem is I can’t find the way to select the adv search shortcode on the search and listings pages. Maybe is not possible…

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount