0

I'm trying to use Custom Field types to embed twetter using the Do_Shortcode() like this :

echo do_shortcode('[tweet https://twitter.com/wordpressdotcom/status/204557548249026561 ]');

And its not work with me after

<?php the_content(); ?>

In my theme.

Iam try search and found this post but not work with me .

How can embed tweet in my theme

1
  • Post the callback that handles the tweet shortcodes.
    – s_ha_dum
    Commented Jun 29, 2015 at 15:34

1 Answer 1

0

Answer

<?php

  /**
   *  Shortcode look like this.
   *  [tweet url="http://www.yourwebsitename.com"] Twitter [/tweet]
  */

  add_shortcode ( "tweet" , "ease_button" );
  function ease_button( $atts, $content ) {  
    extract(shortcode_atts( array(
              "url"     => false,     
    ), $atts ));

    $url = ( $atts['url'] ) ? $atts['url'] : '#';    
    return sprintf( '<a href="%s"> %s </a>',$url, $content );
  }
?>
1
  • where can i add this url https://twitter.com/wordpressdotcom/status/204557548249026561i dont need show link of tweet, i need to show tweet content
    – Android-wd
    Commented Jun 29, 2015 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.