• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

hire php expert for function

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › hire php expert for function

This topic is: not resolved

Tagged: wordpress function

  • This topic has 18 replies, 2 voices, and was last updated 10 years, 4 months ago by handsun.
Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • October 23, 2015 at 9:03 am #168837
    handsun
    Participant

    Hello! I had to switch over form my usual Genesis theme work to a woo commerce theme (Mystile) for a shopping cart job. My client needs the header to be different on different pages, so I was able to find this (an online tutorial) to add to the header.php of the site, which uses featured images as headers. I created a child theme of Mystile and started experimenting on the development site.

    I would like to exclude featured images from displaying on the dynamic product pages, and I do not know the exact php to exclude product pages from this rule (so they have no header image), can you refer me to someone who could give me the line of code I would need to do that

    Of course I will pay for your time

    what I added to header.php in order to change each page's featured image to a unique banner (http://3dbizcenter.com/mm/)

    if ( is_singular() &&
    has_post_thumbnail( $post->ID ) &&
    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail') ) &&
    $image[1] >= HEADER_IMAGE_WIDTH ) :
    // We have a new header image!
    echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    else : ?>

    I found this as a function but it is not working for me (product pages where We require no featured image) http://3dbizcenter.com/mm/product/splat/

    add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 3);
        function remove_featured_image($html, $attachment_id, $post_id) {
        $featured_image = get_post_thumbnail_id($post_id);
        if ($attachment_id != $featured_image) {
            return $html;
        }
        return '';
    }
    

    Clean affordable water by Kinetico

    http://3dbizcenter.com/mm/product/splat/
    October 23, 2015 at 12:53 pm #168848
    Porter
    Participant

    So your final goal is to exclude the featured images from the actual product pages? Show me an actual page, and describe the image you're trying to remove, and I should be able to work something out.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 1:12 pm #168849
    handsun
    Participant

    HI Porter, the site is above the first link, that shows the custom header images on the actual "pages" that have been created.
    the second link shows a dynamic "product" page with the featured image above in the spot that the banner images are in the static pages, on these pages we can just remove the featured image no banner needed. they are all dynamically created by woocommerce and in url is product/, as you see here product/splat. The other pages also have products: urls below
    http://3dbizcenter.com/mm/product/rust-freeze/
    http://3dbizcenter.com/mm/product/atomic-blast-8oz/
    http://3dbizcenter.com/mm/product/atomic-blast-14oz/


    Clean affordable water by Kinetico

    October 23, 2015 at 1:20 pm #168850
    Porter
    Participant

    So you're looking to remove the images (on the product pages) below the "view cart" button / cost area, but above the navigation, correct?

    If so, I can help with that, just trying to figure out exactly what we're changing here, as that'll make me writing code on my end without access a whole lot easier 🙂


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 1:22 pm #168851
    handsun
    Participant

    exactly, but we need to keep the featured images on the static pages! Let me know whatever you might need! Carin


    Clean affordable water by Kinetico

    October 23, 2015 at 1:25 pm #168852
    Porter
    Participant

    Just to confirm what you mean by "static pages", toss me a link to what you're referring to.

    If you could copy the contents of your functions.php file to pastebin and then send me a link to that page (once you post it, the url you're on will let me see that), that would help out as well, just so I can see what's going on, and avoid any potential conflicts (doubt there will be any, just want to double check).


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 1:29 pm #168853
    handsun
    Participant

    http://3dbizcenter.com/mm/splat-bug-remover/
    http://3dbizcenter.com/mm/rust-freeze/
    http://3dbizcenter.com/mm/atomic-blast/
    they contain the products listed above, if you click on a product from one of those pages it opens the dynamic "product" page. These static pages are the "Brand" pages that needed unique headers for each page, hence the featured image solution stated above (it was the only way I could find to do this, the Mystile theme did not work with any of the custom header plugins that I could find)


    Clean affordable water by Kinetico

    October 23, 2015 at 1:31 pm #168854
    Porter
    Participant

    Gotcha, so anything with /product needs that image removed, where as the actual brand pages that list various products will retain the header. I'll get something to you shortly.

    Just to confirm, if I give you some code to add to functions.php, you'll be able to do so, correct?


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 1:32 pm #168855
    handsun
    Participant

    Yes!


    Clean affordable water by Kinetico

    October 23, 2015 at 2:00 pm #168857
    Porter
    Participant

    Can you please post a link to your functions.php file? Either copy it to pastebin as I linked above, or host it on dropbox, anything works, I just need to see what's in that file to determine how featured images are being used in your theme.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 2:08 pm #168858
    handsun
    Participant

    http://pastebin.com/W3Kz9iMm
    I also created a child theme
    functions file is empty right now


    Clean affordable water by Kinetico

    October 23, 2015 at 2:40 pm #168863
    Porter
    Participant

    So I looked into your site a bit more, and it's actually happening on the page template level, so I'm not sure I can get to it from functions.php. That being said, I think I found a rather simple / elegant solution. Add this to your style.css:

    .header .attachment-post-thumbnail {
    	display: none;
    }

    It is your "featured image" being used (easy enough to disable for a custom post type), but BOTH copies of the image (the one above the header, and in the post itself) are the same exact image, so if you kill one, you kill both. The above targets the css for the image in the header only, and leaves the one in the post. I see nothing wrong with this solution, and it should do the job just fine.

    That being said, if you want to fix the "issue" at the root of the cause, I'd need to have the code for the page template. I don't know if "products" is created specifically for the theme (probably), or if that's a custom post type you defined (dynamicly, could be named tacos for all we care), but that would determine how easy it is to change. If you have a "single-products.php" copy the contents of that for me, and I can easily "fix" the issue without the css. Like I said, the css works, but this would technically be a bit more clean, though to the end-user it doesn't matter at all.

    Let me know if:

    -The css works
    -You have a single-products.php (and pastebin that code).


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 2:43 pm #168865
    handsun
    Participant

    I think that will also remove the featured images I am using on the "static" pages?


    Clean affordable water by Kinetico

    October 23, 2015 at 2:46 pm #168867
    Porter
    Participant

    You're absolutely right, my bad. Try adding:

    .single-products .header .attachment-post-thumbnail {
    	display: none;
    }

    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 2:49 pm #168869
    handsun
    Participant

    woocommerce actually provides templates for single product, but because this is in the header.php, thats why i thought we could try and remove the featured image with conditional logic in functions.php.

    can we communicate by email and I can send you the zip of the single-products folder, or maybe I just need to find a better way to add a unique header to the 4 static pages and I can remove that "featured image" code from header.php. thanks so much for your help on this! I will need your email anyway to send you over a paypal!


    Clean affordable water by Kinetico

    October 23, 2015 at 2:50 pm #168870
    Porter
    Participant
    This reply has been marked as private.
    October 23, 2015 at 3:08 pm #168872
    handsun
    Participant

    I added it and no good, then I tried :
    .single-product .header .attachment-post-thumbnail {
    display: none;
    }
    still no good


    Clean affordable water by Kinetico

    October 23, 2015 at 3:09 pm #168873
    Porter
    Participant

    I added my email above in a "set as private reply" post, did you get that?
    I should actually only need your header.php file in this case, as I believe I have a php solution I can add there.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 23, 2015 at 3:17 pm #168877
    handsun
    Participant

    sent!


    Clean affordable water by Kinetico

  • Author
    Posts
Viewing 19 posts - 1 through 19 (of 19 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble