Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   New Versions & Updates (http://forum.bytesforall.com/forumdisplay.php?f=54)
-   -   Patch 127-01: add code to allow do_shortcode() to be used in virtual templates (http://forum.bytesforall.com/showthread.php?t=23156)

juggledad Apr 18, 2015 03:47 AM

Patch 127-01: add code to allow do_shortcode() to be used in virtual templates
 
1 Attachment(s)
If you find this enhancement useful then donate. Donations encourage the continued update of this theme and without that encouragement, continued development could end.

Enhancement: The following patch will add the WordPress 'do_shortcode()' function to the 'Limited PHP Code' allowing it to be used in the virtual templates.

For example: say you use a plugin that allows responsive rotating images - like Soliloquy - and if supports shortcakes. With this enhancement you could edit the virtual sub template 'header.php' and change it from this:
HTML Code:

<div id="banner-bg" class="cf">
        <div id="banner" class="row">
                <div id="logo-area" class="col5">
                        <<?php bfa_if_front_else( 'h1', 'h3' ); ?> id="sitetitle">
                                <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?></a>
                        </<?php bfa_if_front_else( 'h1', 'h3' ); ?>>
                        <p id="tagline"><?php bloginfo( 'description' ); ?></p>
                </div>
                <?php wp_nav_menu( array(
                        'container' =>
'nav',
                        'container_class' => 'menu-wrapper col7',
                        'container_id' => 'menu1-wrapper',
                        'menu_id' => 'menu1',
                        'menu_class' => 'cf menu',
                        'theme_location' => 'menu1',
                        'fallback_cb' => 'bfa_page_menu'
                ) ); ?>
        </div>
</div>

<a href="<?php bloginfo( 'rss2_url' ); ?>" class="rsslink" title="<?php _e( 'Subscribe to RSS Feed', 'montezuma' ); ?>"></a>
               

<div id="breadcrumbs1-bg">
        <nav id="breadcrumbs1" class="breadcrumbs lw">
                <?php bfa_breadcrumbs( 'breadcrumbs1' ); ?>
        </nav>
</div>

to something like this:
HTML Code:

<div id="banner-bg" class="cf">
        <div id="banner" class="row">
                <div id="logo-area" class="col12">
                        <a href="http://www.yourdomain.com/">
              <img class="logo" alt="" src="http://www.yourdomain.com/wp-content/images/yourlogo.jpg">
            </a>
                </div>
  </div>
 
        <div id="header-image-row" class="row">
                <div id="header-image-area" class="col12">
                          <?php echo do_shortcode('[soliloquy id='34']'); ?>
                </div>
          </div>
 
  <div id="pklmenu" class="row">
                <?php wp_nav_menu( array(
                        'container' =>
'nav',
                        'container_class' => 'menu-wrapper col12',
                        'container_id' => 'menu1-wrapper',
                        'menu_id' => 'menu1',
                        'menu_class' => 'cf menu',
                        'theme_location' => 'menu1',
                        'fallback_cb' => 'bfa_page_menu'
                ) ); ?>
        </div>
</div>

This would create a 12 column header image that would use the soliloquy gallery '34' and display it on each page of the site.

you can install this by editing 'montezuma/includesget_whitelist.php' and adding the folowing code after line 488 (which is a blank line)
HTML Code:

                'do_shortcode' => array(
                        'type' => 'single',
                        'examples' => array(
                                "<?php echo do_shortcode('[gallery]'); ?>"
                                        => __( 'This function allows you to insert shortcodes into the Montezuma virtual temlpates', 'montezuma' ),
                                "<?php echo do_shortcode('[soliloquy id='34']'); ?>"
                                        => __( 'This example show how you would use a shortcode provided by the Soliloquy plugin', 'montezuma' ),
                        ),
                        'info' => __( 'This functions does not do the short code by itself. Always use it in combination with <echo>echo</code> as shown in the example.', 'montezuma' ),
                ),

or you can replace the existing 'montezuma/includes/get_whitelist.php' with the attached file.

This will be in the next release.


All times are GMT -6. The time now is 01:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.