Insert random listing in every article post?

This topic contains 9 replies, has 2 voices, and was last updated by  Paolo 9 years, 1 month ago.

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

Open Support Ticket
  • Author
    Posts
  • #50654

    Howard Chan
    Free User
    Post count: 18

    Hi Friends,

    Can I insert “Feature Place Listing”(Random) in every article post?
    Like Google Adsense.

    Thank,
    World Bee Net

    #50698

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    yes you can.

    WordPress provide several hooks for the content.

    With a function like this in your theme functions.php file you should get exactly what you want, by udding the gd popular post view shortcode.

    
    
    function add_shortcode_after_post_content($content) {
    	if ( 'post' == get_post_type() ) {
    		$content .= do_shortcode('[gd_popular_post_view layout=5 add_location_filter=flase character_count=0 show_featured_only=true]');
    	}
    	return $content;
    }
    add_filter('the_content', 'add_shortcode_after_post_content');

    Let us know if it helps.

    Thanks

    #50749

    Howard Chan
    Free User
    Post count: 18

    Hi Paolo,

    yes, its work but other plugin no work
    Tablepress & contact form 7
    will appear code only [contact-form-7 id=”212″ title=”xxxx”]

    #50808

    Paolo
    Site Admin
    Post count: 31206

    Hi again,
    I just tested with this and it works:

    
    
    function add_shortcode_after_post_content($content) {
    	if ( 'post' == get_post_type() ) {
    		$content .= do_shortcode('[contact-form-7 id="3071" title="Contact form 1"]');
    	}
    	return $content;
    }
    add_filter('the_content', 'add_shortcode_after_post_content');
    

    Are you trying to add more than one elements via shortcodes? Can I see your function?

    Let us know,

    Thanks

    #50812

    Howard Chan
    Free User
    Post count: 18
    This reply has been marked as private.
    #50858

    Paolo
    Site Admin
    Post count: 31206

    HI,

    I don’t see any function on your theme. Can you please let me know what exactly are you trying to do or pass me the function you are trying to add. Without seeing it I cannot correct it?

    My functions above work…

    Thank you

    #50867

    Howard Chan
    Free User
    Post count: 18

    hi Paolo, i just try a few minute, then removed above coding (#50698), because I worry put it long time, the visitors cant using contact form. so you don’t see any function on my theme.

    so maybe u also can try it on site?

    i scapture let you see

    Before Coding
    1.png

    After insert coding (#50698) in Theme Functions (functions.php)
    2.png

    #50930

    Paolo
    Site Admin
    Post count: 31206

    OK i think I understand now, but how is that contact form added after the content?

    If you have more than one function trying to do the same thing, 1 could create a conflict with the other.

    Let us know,

    #51479

    Howard Chan
    Free User
    Post count: 18
    This reply has been marked as private.
    #51480

    Paolo
    Site Admin
    Post count: 31206
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 10 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