• Resolved energykick

    (@energykick)


    So far I love this plugin but I use shortcodes in my title and access them with get_the_title() which has always worked. I have the title to shortcode enabled on my site. My problem is I cannot figure out where (if it is possible) to change the title output to do my shortcode. I tried this:

    $zg_get_title = get_the_title($value+0);

    and this:

    echo "<a href=\"". get_permalink($value+0) . "\" title=\"". $zg_title_out->post_title . "\">". get_the_title($value+0) . "</a>\n";

    but both give a sql error so I am missing something about the loop. I would love to see if this can be done.

    Thanks!

    https://www.ads-software.com/extend/plugins/last-viewed-posts/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter energykick

    (@energykick)

    Now I have found some nice way to format my output with a photo and all like this:

    echo "<div style=\"width: 550px;\"> <div style=\"float: left; width: 100px;\">";
    echo "<img class=\"floatLeft\" src=".get_the_post_thumbnail( $post_id, array(100,100));echo "</div> <div style=\"float: left; padding-left: 10px; width: 430px;\">";
    echo "<a href=\"". get_permalink($value+0) . "\" title=\"". $zg_title_out->post_title  . "\">". $zg_title_out->post_title . "</a>\n";
    echo "</div>";
    echo "<br style=\"clear: left;\" /><hr>";

    but still cannot get the title to calculate my shortcode. I also tried this:
    $zg_get_title = do_shortcode('[exercisetitle]');

    but it also gives and error. Does anyone have ideas how this can be done.

    thanks!

    Plugin Author Noumaan Yaqoob

    (@noumaan)

    Another neat way to do this is to find out the function used to add shortcode your will find function name in the add_shortcode line inside your functions.php or the plugin that generated the shortcode.

    add_action('exercisetitle', 'function_name');

    use that function like this

    $zg_get_title = function_name();

    Thread Starter energykick

    (@energykick)

    Oh, thank you for answering so quick. I understand some things but not how the title shortcode works. I just added this to function.php

    add_filter( ‘the_title’, ‘do_shortcode’ );

    and it works. Do you know if there is a way I can use your $zg_get_title to tie into that somehow.

    Thanks
    Rob

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using [shortcode] in title.’ is closed to new replies.