• hi how do i add my shortcode to wordpress yoast description box & keyboard box.

    here is the only plugin file i use to spin the words and shortcode of it..

    <?php
    /*
    Plugin Name: Text Spinner
    Plugin URI: https://wpgurus.net/
    Description: Allows you to use spintax in your posts, pages and theme files.
    Version: 0.1
    Author: Hassan Akhtar
    Author URI: https://wpgurus.net/
    License: GPL2
    */
    
    /**********************************************
    *
    * Spintax functions
    *
    ***********************************************/
    
    function wpts_spin($text)
    {
        return preg_replace_callback(
            '/\{(((?>[^\{\}]+)|(?R))*)\}/x',
            'wpts_replace',
            $text
        );
    }
    
    function wpts_replace($text)
    {
        $text = wpts_spin($text[1]);
        $parts = explode('|', $text);
        return $parts[array_rand($parts)];
    }
    
    /**********************************************
    *
    * Shorcode setup
    *
    ***********************************************/
    
    function wpts_render_shortcode( $atts, $content = null ) {
    	return wpts_spin($content);
    }
    add_shortcode( 'wpts_spin', 'wpts_render_shortcode' );

    this is the shortcode i use on content page that works
    [wpts_spin]{Great|Awesome|Somewhat Adequate}[/wpts_spin]

    how do i make this work on yoast description box and keyboard box help will be much appreciate it cheers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter aggass2001

    (@aggass2001)

    do i add this code

    function add_shortcode_to_title( $title ){
            return do_shortcode($title)
        }
        add_filter( 'the_title', 'add_shortcode_to_title' );

    in 1 of the yoast php file ?

    Thread Starter aggass2001

    (@aggass2001)

    little help will be appreciated cheers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do i add shortcodes to wordpress yoast description & keywords’ is closed to new replies.