• Resolved laquaze

    (@laquaze)


    Hi,

    I’m using the plugin because it’s really lightweight in comparison to other get_the_content plugins.

    Everything works really fine but I have one problem in combination with one of my own shortcodes.

    I did this in functions.php:

    function get_title_shortcode(){
    	return get_the_title();
    }
    add_shortcode( 'gettitle', 'get_title_shortcode' );

    I created a shortcode that gets the title of the post and is inserted in pictures as alt=”[gettitle]”.

    Now when I use the “Get Post Content Shortcode” plugin to post content from one post on another I want that the [gettitle] results with the actual title and not the title from the embedded post. Is there any way to get the actual title in that situation?

    Thanks in advance,
    Benjamin

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author webdeveric

    (@webdeveric)

    Benjamin,
    When using your [gettitle] shortcode within [post-content] the behavior you’re seeing is intentional.

    To get what you want, the [gettitle] shortcode needs to be updated to look for the outer most post_id.

    I’ve made a replacement shortcode that should do what you want.

    https://github.com/webdeveric/get-title-shortcode

    Let me know if that works for you.

    Eric

    Thread Starter laquaze

    (@laquaze)

    Hi Eric,

    I’m so sorry I didn’t answer earlier. That was absolutly what I was looking for.
    It works great!

    Thank you so much for your help! ??

    Benjamin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get the title of current post’ is closed to new replies.