I am trying to combine html and running a shortcode in my custom function output but I am getting a parse error. Please see below for what I am trying to achieve. Is this approach correct or is there a better way of achieving this?
function gshar_text_shortcode() {
return '<span class="kalia">Share with friends</span><div class="kalisha">' . echo do_shortcode('[share facebook="true" twitter="true" linkedin="true" email="true"]') . '</div>';
}
add_shortcode('globeshare', 'gshar_text_shortcode');
My [share]
shortcode in functions.php
function x_portfolio_item_social_v2() {
$share_project_title = x_get_option( 'x_portfolio_share_project_title' );
$enable_facebook = x_get_option( 'x_portfolio_enable_facebook_sharing' );
$enable_twitter = x_get_option( 'x_portfolio_enable_twitter_sharing' );
$enable_google_plus = x_get_option( 'x_portfolio_enable_google_plus_sharing' );
$enable_linkedin = x_get_option( 'x_portfolio_enable_linkedin_sharing' );
$enable_pinterest = x_get_option( 'x_portfolio_enable_pinterest_sharing' );
$enable_reddit = x_get_option( 'x_portfolio_enable_reddit_sharing' );
$enable_email = x_get_option( 'x_portfolio_enable_email_sharing' );
$share_url = urlencode( get_permalink() );
$share_title = urlencode( get_the_title() );
$share_source = urlencode( get_bloginfo( 'name' ) );
$share_content = urlencode( get_the_excerpt() );
$share_image = urlencode( x_get_featured_image_with_fallback_url() );
[truncated...]
if ( $enable_facebook == '1' || $enable_twitter == '1' || $enable_google_plus == '1' || $enable_linkedin == '1' || $enable_pinterest == '1' || $enable_reddit == '1' || $enable_email == '1' ) :
?>
<div class="x-entry-share">
<div class="x-share-options">
<?php echo $facebook . $twitter . $google_plus . $linkedin . $pinterest . $reddit . urldecode( $email ); ?>
</div>
</div>
<?php
endif;
}
add_action('wp_head', 'change_item_social_v2');
function change_item_social_v2() {
remove_shortcode( 'share' );
add_shortcode( 'share', 'x_portfolio_item_social_v2' );
}