Support » Developing with WordPress » Creating a Custom Shortcode

  • Accourding to thsi web site;

    I believe the code ;
    the function

    // $attributes is an array of passed-in attributes. It would look like
    // [ 'align' => 'left' ].
    // $content is a string of passed-in shortcode content. It would look like
    // 'This is the text that should go inside my pullquote'.
    function pqsc_process_shortcode( $attributes, $content = null ) {
    	// Save each attribute's value to its own variable.
    	// This creates a variable $align with a value of 'left'.
    	extract( shortcode_atts( array(
    		'align' => ''
    	), $attributes ) ); 
    	// Return a string to display on the page
    	return '<blockquote>' . $content . '</blockquote>';

    is posted under functions.php.

    But where exactly is ;

    [pullquote_shortcode align=”left”]This is the text that should
    go inside my pullquote[/pullquote_shortcode]

    Posted ?

    Thank you in advance


    • This topic was modified 1 year, 3 months ago by  bcworkz. Reason: code fixed, title de-allcapped
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    The shortcodes using [square brackets] are placed in post and page content. When the page is output, WP code searches content for known shortcode tags within square brackets and replaces any such occurrences with the returned value of the respective shortcode handler.

    BTW – please don’t “SHOUT” (use all caps) in topic titles or anywhere else. It’s considered rude. I’m sure that was not your intention, that you were just unaware. Now you know.

    you are right , i was not aware. Thank you for your guidance and support.

    You learn everyday. When you think you know it all , a big universe opens. Aristotle has rightly said;

    “The more you know, the more you know you don’t know.”

    ― Aristotle

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating a Custom Shortcode’ is closed to new replies.