Support » Fixing WordPress » PHP if to remove div

  • WeirdMike


    I would like to remove a featured image I have called inside of a div without a name on ALL of my MarketPress pages on my site but allow it everywhere else.

    Is there a condition tag to hide the div with any url slug that contains /store?

    If so, how can this be done?

    (a breakdown of the code would be grand for learning if I need it in the future)

Viewing 5 replies - 1 through 5 (of 5 total)
  • WeirdMike


    This is what’s happening when I attach a featured image to my product (which I need for the main product page to show the thumbnail)

    What it looks like elsewhere on the site
    (images haven’t been updated)

    What I want things to look like in the /store

    Moderator Andrew Nevins


    Front-end developer

    Need you use PHP, opposing CSS?



    I could use display none but that doesn’t help in using conditional tags.

    I used this once in my template and it worked out well for me. I would retrieve the page name or post name and decide based on this what to show…

    $pageslug = $post->post_name; // name of the page (slug) or post
    $catslug = get_category_by_slug($pageslug); // get category of the same slug
    $catid = $catslug->term_id;  // get id of this category
    $query= 'cat=' . $catid. ''; //Get the cat
    query_posts($query); // run a query if you so wish
    //For example here am testing for the contact us page - can't recall if it worked with default or pretty permalinks may be try both
    //this can also test for $catslug i.e category
    if (!($pageslug == "contact-us")){
    //Do my stuff here based on the slug test


    I will try this in the morning and let you know how it worked. Hopefully MarketPress uses “store” as a category and not just a dir link

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP if to remove div’ is closed to new replies.