Add featured image to the listing

This topic contains 6 replies, has 4 voices, and was last updated by  Paolo 8 years, 10 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #62770

    Rob Hilken
    Free User
    Post count: 5

    Hi,

    I have taken off the slider from the listing page and wish to replace it with just a single static image (the featured image)

    I removed the slider by adding

    remove_action( 'geodir_details_main_content','geodir_action_details_slider',30);

    to my functions file. Is there an easy action to add in the featured image?

    Thanks,

    Rob

    #62782

    Guust
    Moderator
    Post count: 29970

    I’ll get Paolo to have a look at your question.

    #62862

    Paolo
    Site Admin
    Post count: 31206

    hi,

    this should do it, please try adding it in your functions.php

    
    
    remove_action( 'geodir_details_main_content','geodir_action_details_slider',30);
    
    add_action( 'geodir_details_main_content','my_geodir_action_details_slider',30);
    
    function my_geodir_action_details_slider() {
    
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
    	the_post_thumbnail('full');
    } 
    }

    Let us know how you went,

    Thanks

    #65018

    Tony
    Expired Member
    Post count: 147

    Hi I need to do this so the main image thumbnail appears,

    and the rest of the images appear in the images tab.

    Meaning remove the slider, and hopefully just the main image.

    I tried putting this code in the child theme functions but got an error.
    basically remove slider, put in main thumbnail image (the first one) and show the others in the Photo’s section

    Or I’d love to show the thumb in the sidebar.

    Is there php for that I could sneak in with the others?

    I’ll attach a screen shot. This is the error I get.

    remove_action( ‘geodir_details_main_content’,’geodir_action_details_slider’,30); add_action( ‘geodir_details_main_content’,’my_geodir_action_details_slider’,30); function my_geodir_action_details_slider() { if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(‘full’); } }
    Warning: Cannot modify header information – headers already sent by (output started at /home4/jimliu/public_html/findadoctor.drnaturalhealing.com/wp-content/themes/GDF_child/functions.php:26) in /home4/jimliu/public_html/findadoctor.drnaturalhealing.com/wp-content/themes/GDF_child/geodirectory/listing-detail.php on line 12 – See more at: http://findadoctor.drnaturalhealing.com/practitioners/united-states/delaware-1/milford/acupressure-1/mark-singley/#post_images

    http://www.awesomescreenshot.com/image/859637/4d2909a02e380a628d436cac78cc4e5d

    #65137

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    the code I provided above is correct and works, we’d need to have a look at how you pasted it on your functions.php to see why it gives an error.

    Please provide admin credentials in a private reply.

    Thanks

    #65311

    Tony
    Expired Member
    Post count: 147

    HI Paolo!
    The code works if I put in the main functions.php not the child. But yes it works!

    Now If I could only add it to the sidebar I wonder if I could figure that out with the php code.
    Maybe I’ll make a plugin and submit it to you.

    Mark

    #65347

    Paolo
    Site Admin
    Post count: 31206
Viewing 7 posts - 1 through 7 (of 7 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