Support » Fixing WordPress » [Plugin: Add to Any: Share/Bookmark/Email Button] Unique title for home page…

  • I have the “Featured Content” plugin running on my homepage. Add to Any is picking up the Post ID’s from this plugin as it cycles through the display. I’d like to configure it to output the proper home page info when on the front page.

    Is it possible to set up a conditional that will check for the front page and return the blog name and url instead of post id’s and permalinks?

    Thanks in advance,

    Scott

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey Scott, good investigative work. Unfortunately this is a known issue, and I’m still seeking a fix.

    One workaround would be to only display the button on single post pages instead of your homepage. (See the plugin’s settings panel.)

    Is it possible to set up a conditional that will check for the front page and return the blog name and url instead of post id’s and permalinks?

    Not yet with the plugin, but you could grab the generic code from addtoany.com instead.

    Thread Starter sdix

    (@sdix)

    I don’t know a ton about programming, so bear with me…

    It looks like there are four variables in place that do the work of delivering the link to Add to Any:

    $linkname	= get_the_title($post->ID);
    	$linkname_enc	= rawurlencode( $linkname );
    	$linkurl	= get_permalink($post->ID);
    	$linkurl_enc	= rawurlencode( $linkurl );

    Can some code slipped in to offer WordPress an option to use a different set of variables that does something like this (ignore syntax, pls):

    if is_front_page()
    
    	$linkname	= bloginfo('name');  (or hardcodedtext)
    	$linkname_enc	= rawurlencode( $linkname );
    	$linkurl	= bloginfo('url');  or hardcoded link)
    	$linkurl_enc	= rawurlencode( $linkurl );	
    
    else
      ... continue as normal.

    Thanks!

    Had a similar problem.
    My solution was to hard code it like the suggestion above.

    if ($_SERVER['SERVER_NAME']=='example.com' && $_SERVER['REQUEST_URI'] == '/blogPath/') {
      $linkname		= "Page Title";
    	$linkname_enc	= rawurlencode( $linkname );
    	$linkurl		= "http://example.com/blogPath/";
    	$linkurl_enc	= rawurlencode( $linkurl );
    } else {
      $linkname		= get_the_title($post->ID);
    	$linkname_enc	= rawurlencode( $linkname );
    	$linkurl		= get_permalink($post->ID);
    	$linkurl_enc	= rawurlencode( $linkurl );
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Add to Any: Share/Bookmark/Email Button] Unique title for home page…’ is closed to new replies.