Support » Plugin: Secondary Title » get primary title using shortcode

  • Resolved ramanandmehta

    (@ramanandmehta)


    Hi first of all thanks for this amazing plugin, I can’t explain how much this is helpful plugin for me.
    we can get the current post secondary title using this shortcode- [secondary_title]
    but what if we want to get the primary title? which shortcode we can use? please help.
    ——————————————————
    function post_title_shortcode(){
    return get_the_title();
    }
    add_shortcode(‘post_title’,’post_title_shortcode’);
    ————————————————————–
    I added this code in my theme’s function.php and then using shorcode [post_title]
    but this is adding full title (primary + Secondary).
    I want to add only primary title using shortcode. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • thanks for this amazing seo plugin. it helped me a lot
    here are my some articles ypou can read : flirt meaning

    Plugin Author thaikolja

    (@thaikolja)

    Hi,

    Sorry for the late reply.

    Instead of return get_the_title();, try using:

    global $post;
    
    return $post->post_title;

    I didn’t test it, but it should work. If not, I have another idea.

    Thread Starter ramanandmehta

    (@ramanandmehta)

    Wow,.This is working sir, thank you very much. You are not just a WordPress developer, You are amazing by the mind and by the heart.

    Plugin Author thaikolja

    (@thaikolja)

    Glad it worked out!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘get primary title using shortcode’ is closed to new replies.