WordPress.org

Forums

Using Shortcodes on Static Pages? (7 posts)

  1. adamj3333
    Member
    Posted 2 years ago #

    Is this possible? I'd like to create a text link (see: Portfolio link @ http://www.deyoungmedia.com) to pop-up a lightbox effect with full images.

    Is this possible?

    Thank you.
    Adam

  2. JungleSpace.net
    Member
    Posted 2 years ago #

    It is possible to insert shortcodes into post and page.

    If you need more information, you could visit the documentation here.

    http://codex.wordpress.org/Shortcode_API

  3. adamj3333
    Member
    Posted 2 years ago #

    Thanks for your answer. I've been able to insert them into a post and a page, but this is my homepage and I am not clear how to do this. On this page, I added all the content in the index file, not through the WordPress admin.

  4. JungleSpace.net
    Member
    Posted 2 years ago #

    Then you would directly call the function which was registered to the shortcode in your index.php. Example below.

    `
    //[foobar]
    function foobar_func( $atts ){
    return "foo and bar";
    }
    add_shortcode( 'foobar', 'foobar_func' );
    `

    Call foobar_func($arg) in your index.php

  5. alchymyth
    Forum Moderator
    Posted 2 years ago #

    to use shortcode in a php template, try

    <?php echo do_shortcode('[wheatevershortcode]'); ?>

    http://codex.wordpress.org/Function_Reference/do_shortcode

  6. adamj3333
    Member
    Posted 2 years ago #

    @alchymyth I tried that and for some reason or another it's not working.

  7. alchymyth
    Forum Moderator
    Posted 2 years ago #

    some things in square brackets are no real shortcodes;

    in this case, try:

    <?php echo apply_filters('the_content','[wheatevershortcode]'); ?>

    if this does not work, please post the real example shortcode and post where the shortcode comes from - plugin or theme or selfmade...

Topic Closed

This topic has been closed to new replies.

About this Topic