Add Social Sharing Buttons

Community Forums Forums Design Tips and Tricks Add Social Sharing Buttons

This topic is: not resolved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  cdils 4 months, 4 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #100361

    rysrivarshan
    Member
    Post count: 2

    Hi,

    I am using Streamline Pro Theme and trying to get around Genesis on a XAMPP installation locally. Though i am new to PHP i am willing to learn and apply things.

    I want to add my own social sharing buttons and hence I have the used the below code in my functions.php,

    add_filter( 'genesis_post_info', 'post_info_filter' );
    
    function post_info_filter( $post_info ) {
    
    	if ( !is_page() ) {
    			$postURL=get_permalink($post->ID);
    			$post_content=the_excerpt(); 
    			$post_info="<a href='https://twitter.com/intent/tweet?=$postURL&text=$post_content' target='_blank'>Link</a>";
        	return $post_info;
    	}	
    }

    I have few issues and would be really glad if someone could help me,

    1) $post_content=the_excerpt(); – This line automatically outputs the excerpt in a <p> tag outside the entry-meta class, but i haven’t printed it out, what am i missing here?

    2) The output URL is as below:

    Link

    I am able to get the URL but not the excerpt in the above URL, what am i doing wrong here?

    http://localhost
    #101485

    cdils
    Participant
    Post count: 421

    the_excerpt() automatically prints the value to the page. If you want to store the value in a variable and print when you’re ready, try get_the_excerpt() instead.


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. :)

    I host a weekly Genesis-focused podcast called Genesis Office Hours. I tweet @cdils.

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

You must be logged in to reply to this topic.