Support » Themes and Templates » How to Insert Shortcode into Theme?

  • Hi,
    I have content locker plugin.

    For locking contents, im using this shortcode:

    [wp-like-locker]
    Your locked content here…
    [/wp-like-locker]

    and I need lock every post on my blog. How could I instert this shortcodes into theme and lock:

    <?php the_content(); ?>

    Thank you very very very much for your answer and time!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can use the shortcode funtions in your template files by calling the functions directly.

    As an example, if the [testing] shortcode was set to call the show_testing() function, then you could just add

    <?php echo show_testing(); ?>

    to your template file.

    To find out what the function is for the [wp-like-locker] shortcode you can do a search through the source code of the plugin to find where the shortcode is registered. Most good text editors will let you do a global search, so search for ‘wp-like-locker’ and you’ll see the results. If you haven’t got a text editor that can do that you can look through the code manually and search for the register_shortcode() function for that shortcode.

    You ate using the short code in the post editor, to lock the content of the post?

    No easy solution you need to open each post and add the short code to lock the part of the content you want to lock.

    HTH

    David

    <?php echo do_shortcode(‘[wp-like-locker]’); ?>

    @MickyRoush,
    I think the OP wants something to add the shortcode to all existing posts, as in lock all posts content!

    Regards

    David

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Insert Shortcode into Theme?’ is closed to new replies.