WordPress.org

Ready to get started?Download WordPress

Forums

How to Insert Shortcode into Theme? (5 posts)

  1. PEGGAS
    Member
    Posted 2 years ago #

    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!

  2. michael.mariart
    Member
    Posted 2 years ago #

    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.

  3. Digital Raindrops
    Member
    Posted 2 years ago #

    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

  4. MickeyRoush
    Member
    Posted 1 year ago #

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

  5. Digital Raindrops
    Member
    Posted 1 year ago #

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

    Regards

    David

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.