Plugin related and other generic customizations 2

(Difference between revisions)
Jump to: navigation, search
(Carousel)
m (How to set up Shopp in iThemes Builder)
(32 intermediate revisions by 2 users not shown)
Line 389: Line 389:
 
[[File:Cart- -Builder-Test-Site-2011-12-03-18-42-53.jpg|776px|thumb|none]]
 
[[File:Cart- -Builder-Test-Site-2011-12-03-18-42-53.jpg|776px|thumb|none]]
  
== How to add smooth animation effect for navigation menus ==
 
  
[http://jsfiddle.net/ronald/nBFm3/ Live demo]
+
[http://webdesign.com/web-design-courses/under-the-hood-with-shopp-videos/ Replay videos of Under the Hood with Shopp training webinar]
 
+
Go to My Theme -> Settings -> Analytics and JavaScript Code. Paste the following in the text area under
+
 
+
"List any JavaScript or other code to be manually inserted inside the site's <head> tag in the input below."
+
 
+
<pre class="brush:php;">
+
<script type='text/javascript'>
+
jQuery(document).ready(function() {
+
            jQuery(".menu ul").css({display: "none"}); // Opera Fix
+
            jQuery(".menu li").hover(function(){
+
                          jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show(500);
+
            },function(){
+
                            jQuery(this).find('ul:first').css({visibility: "hidden"});
+
            });
+
  });
+
</script>
+
</pre>
+
 
+
Save settings.
+
 
+
Note: in the code sample, it is assumed that your menu unordered list tag has a class of "menu" (<code>&lt;ul id="menu-main" class="menu"></code>). To make sure, inspect the menu using Firebug.
+
 
+
[http://ithemes.com/forum/topic/21002-navigation-with-animated-effect/ Forum topic].
+
  
 
== How to float a div at any position on top of other elements in the container ==
 
== How to float a div at any position on top of other elements in the container ==
Line 518: Line 494:
  
 
[[File:2012-03-01 11-11-28.png|547px|thumb|none]]
 
[[File:2012-03-01 11-11-28.png|547px|thumb|none]]
 +
 +
'''8.''' If comments area is not appearing in single CPT entry pages on the site, go to My Theme -> Settings -> Comments. Uncheck the CPT, save settings, re-check it and save settings.
  
 
== How to show top most (latest) post in full and the others as excerpts ==
 
== How to show top most (latest) post in full and the others as excerpts ==
Line 798: Line 776:
 
=== Tiled Galleries ===
 
=== Tiled Galleries ===
  
[http://jetpack.me/support/tiled-galleries/ JetPack's Tiled Galleries] module '''does not work in iThemes Builder''' for the time being.
+
[http://jetpack.me/support/tiled-galleries/ JetPack's Tiled Galleries] module works in iThemes Builder (v4.0.15 and above) by using a workaround.
  
Technical Note: Unlike Jetpack's Carousel, Tiled Galleries has no filter, it simply has the "do nothing if something else has already done something" conditional without the filter to bypass it. We are trying to find a way around this (as, like Carousel, Tiled Galleries works just fine when this bail out conditional is bypassed).
+
Add the following in child theme's <tt>functions.php</tt> file (after the <code>&lt;?php</code> line):
 +
 
 +
function custom_disable_builder_gallery() {
 +
    remove_filter( 'post_gallery', 'builder_custom_post_gallery', 10 );
 +
}
 +
add_action( 'builder_theme_features_loaded', 'custom_disable_builder_gallery' );
 +
 +
$content_width = 604;
 +
 
 +
Note that the <code>$content_width</code> variable has to be set to a value that refers to the pixel width of the area displaying the gallery. The <tt>604</tt> number refers to the total pixel width area of the Default child theme's Content Module without any Layout modifications (960 pixel wide Layout with a 320 pixel wide sidebar). Until a better solution can be found, this variable will have to be manually adjusted so that the gallery properly fills the content area. Fortunately, if you are running a responsive Builder child theme, you can set this value to be larger than required, and it will automatically shrink down (this may work in some non-responsive child themes as well, the results vary).
 +
 
 +
Set <code>$content_width</code> value to the width of actual content portion (.builder-module-content .builder-module-element) that is available after any padding. Firebug makes it easy to find this.
 +
 
 +
[[File:2013-01-31 11-10-53.png|800px|thumb|none]]
 +
 
 +
Source: [http://ithemes.com/codex/page/Builder/Release_Notes/4.0.15 Builder 4.0.15 release notes].
 +
 
 +
<u>Limitation</u>: When the above code is used, output of standard gallery shortcode, for example, <code>[gallery ids="1072,1070,1062,1050"]</code> will be affected. This is a known issue for the time being.
 +
 
 +
<gallery>
 +
File:Screen Shot 2013-01-31 at 11.43.35 AM.png|Before
 +
File:Screen Shot 2013-01-31 at 11.44.35 AM.png|After
 +
</gallery>
 +
 
 +
== How to embed a Gravity Forms form at the bottom of all single posts ==
 +
 
 +
[[File:2013-02-01 19-34-41.png|308px|thumb|none]]
 +
 
 +
'''1.''' Go to Forms -> Forms in WP dashboard. Hover mouse on the title of form that you wish to embed and note the number at the end of URL in browser status bar. That would be the form's ID.
 +
 
 +
'''2.''' Edit child theme's <code>single.php</code>. If the child theme does not have this, copy it from parent Builder directory into the child theme directory.
 +
 
 +
Below
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
<?php comments_template(); // include comments template ?>
 +
</pre>
 +
 
 +
paste
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
<?php gravity_form(2, true, false, false, '', false); ?>
 +
</pre>
 +
 
 +
In the above change <code>2</code> to the ID of form you wish to embed.
 +
 
 +
Source: http://www.gravityhelp.com/documentation/page/Embedding_A_Form
 +
 
 +
'''3.''' Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):
 +
 
 +
<pre class="brush:css; gutter: false;">
 +
#gform_wrapper_2 {
 +
    margin-top: 4em;
 +
}
 +
</pre>
 +
 
 +
In the above change <code>2</code> to the ID of form that's embedded.
 +
 
 +
== Examples of Using jQuery in Builder ==
 +
 
 +
=== Disclaimer ===
 +
'''iThemes will not be responsible for any issues that may be the result of your attempts to change your site's functions.php file. You do not HAVE to change it. All code samples are for your information, possibly inspiration, and provided "as is". However, when properly implemented, the code samples are accurate and will work.'''
 +
 
 +
=== Warning ===
 +
If you do not understand what it is you are doing, if the words "php", "opening tag", "FTP", "functions" and "backup" are not familiar to you proceed with caution. You can blow up your site due to invalid code in the functions.php file. Actually, even if you know or think you know it all, it still happens (it happens to me at least once a week - Ronald).
 +
 
 +
A single missing } or even a , or a semi-colon is all it takes to take your site down. This can be resolved by undoing the changes, however, this can not be done through the wp-dashboard > Appearance > Editor anymore (since your site is down). You then have to restore the functions.php file either through FTP or your hosting cPanel File Manager.
 +
 
 +
'''If you think you can not do that, or do not understand what all the above means, I suggest you refrain from editing functions.php.'''
 +
 
 +
Should anything go wrong, do not blame the code posted here. The code works. It just needs to be inserted a) the right way, and b) in the right place.
 +
 
 +
For everyone else feeling confident, and having read the Disclaimer and the paragraph on how to add PHP code to a PHP file, DO MAKE A BACKUP, at least of the file you are editing. It is also not recommended to do these changes through the wp-dashboard > Appearance > Editor. Setup a localhost server on your computer, and use a simple PHP Editor (with syntax checking), ensure that your additions do not break the site and only THEN FTP your files to your server.
 +
 
 +
=== How to add PHP code to a PHP file ===
 +
When adding code to the <code>functions.php</code> file (or any PHP file), make sure it is in PHP format. HTML code is not PHP code, and it '''WILL''' break things when coded inside a block of PHP code.
 +
 
 +
PHP code can be identified by an opening tag: <code><?php</code>
 +
and a closing tag <code>?></code>
 +
 
 +
all code between these tags should be PHP code.
 +
 
 +
Most WordPress themes have the opening <code><?php</code> tag in functions.php, coded all the way at the top of the file. Most (Builder Child theme) <code>functions.php</code> files do not have a closing <code>?></code> tag (ALL THE WAY) at the end of the file, since it is not required.
 +
 
 +
So if you add code at the end of your <code>functions.php</code> file, and do so before the closing <code>?></code> PHP tag (if any!) you (generally!) are inside a PHP block of code. But this is '''NOT''' guaranteed.
 +
 
 +
*You can't add html code inside PHP tags.
 +
*You can't add PHP code outside PHP tags.
 +
*You can't add opening PHP tags INSIDE a block of PHP code (nesting <code><?php some php code ?></code> when there is no closing php tag before it).
 +
 
 +
Before making the final edits and saving and uploading the file to your server, make sure that the syntax of the entire functions.php is valid syntax. You can do so by using a PHP Editor, and there are online tools such as this one: http://www.piliapp.com/php-syntax-check/
 +
 
 +
====example of correct PHP code====
 +
<pre class="brush: php; gutter: false;">
 +
<?php
 +
PHP code
 +
?>
 +
 
 +
html code
 +
 
 +
<?php
 +
some more PHP code
 +
?>
 +
</pre>
 +
 
 +
====example of in correct PHP code 1====
 +
<pre class="brush: php; gutter: false;">
 +
<?php
 +
php code
 +
 
 +
  <?php
 +
  some more php code
 +
  ?>
 +
 
 +
?>
 +
</pre>
 +
 
 +
====example of in correct PHP code 2====
 +
<pre class="brush: php; gutter: false;">
 +
<?php
 +
html code
 +
?>
 +
</pre>
 +
 
 +
====example of incorrect PHP code 3====
 +
<pre class="brush: php; gutter: false;">
 +
<?php
 +
php code
 +
?>
 +
 
 +
more php code
 +
</pre>
 +
 
 +
 
 +
=== Introduction ===
 +
 
 +
Please note that code shown is for a particular child theme and for a specific version used when writing the articles. It would usually have to be modified to suit your needs. All code samples use certain selector names (for menus, for builder selectors etc.) This is entirely arbitrary, and it is ''highly unlikely'' that your selectors are the same. '''You have to adapt the code accordingly'''.
 +
 
 +
'''All code samples provided here ASSUME that it will be placed in already existing PHP tags. Therefore, you will not find an opening <?php code at the start, or a closing ?> tag at the end.'''
 +
 
 +
=== How to assign odd and even classes to menu items in nav bar ===
 +
 
 +
One typical usage of this would be to set different background colors to alternate menu items.
 +
 
 +
[[File:2013-02-02 21-15-52.png|567px|thumb|none]]
 +
 
 +
Add the following at the end of child theme's <code>functions.php</code>:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// Assign even and odd classes to nav bar menu items
 +
 
 +
add_action('wp_enqueue_scripts', 'add_my_code_1');
 +
 
 +
function add_my_code_1() {
 +
    add_action( 'print_footer_scripts', 'my_footer_script_1' );
 +
}
 +
 
 +
function my_footer_script_1() { ?>
 +
    <script type="text/javascript">
 +
        jQuery(document).ready(function($) {
 +
        $("#menu-main-menu > li:nth-child(odd)").addClass("odd");
 +
        $("#menu-main-menu > li:nth-child(even)").addClass("even");
 +
        });
 +
    </script>
 +
<?php }
 +
</pre>
 +
 
 +
where <code>menu-main-menu</code> is the CSS ID of custom menu shown in the nav bar.
 +
 
 +
Add the following at the end of child theme's <code>style.css</code> (WP dashboard -> Appearance -> Editor):
 +
 
 +
<pre class="brush: css; gutter: false;">
 +
.builder-module-navigation li.even a {
 +
    background: red;
 +
}
 +
 
 +
.builder-module-navigation li.odd a {
 +
    background: blue;
 +
}
 +
 
 +
.builder-module-navigation li.even li a,
 +
.builder-module-navigation li.odd li a {
 +
    background: #FFF;
 +
}
 +
 
 +
.builder-module-navigation li a:hover,
 +
.builder-module-navigation li.even li a:hover,
 +
.builder-module-navigation li.odd li a:hover {
 +
    background: #333;
 +
    color: #FFF;
 +
}
 +
 
 +
.builder-module-navigation .current_page_item.even a, .builder-module-navigation .current_page_item.odd a
 +
.builder-module-navigation .current-cat.even a, .builder-module-navigation .current-cat.odd a
 +
.builder-module-navigation .current-menu-item.even a, .builder-module-navigation .current-menu-item.odd a {
 +
background: #333;
 +
}
 +
 
 +
.builder-module-navigation li a,
 +
.builder-module-navigation .current_page_item li a,
 +
.builder-module-navigation .current-cat li a {
 +
color: #FFF;
 +
}
 +
 
 +
.builder-module-navigation li li a {
 +
    color: #333;
 +
}
 +
</pre>
 +
 
 +
Ex.:
 +
 
 +
[http://www.wpcon186.info/ Live Demo]. Code used on this site: [http://pastebin.com/Kwr3Q1g7 functions.php], [http://pastebin.com/irx9GtC8 style.css].
 +
 
 +
=== How to spread/space out menu items equally across the nav bar ===
 +
 
 +
[[File:Screen Shot 2013-02-02 at 9.43.51 PM.png|800px|thumb|none|Before]]
 +
 
 +
[[File:Screen Shot 2013-02-02 at 9.39.19 PM.png|800px|thumb|none|After]]
 +
 
 +
Add the following at the end of child theme's <code>functions.php</code>:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// =========================================
 +
// = Space out nav bar menu items equally =
 +
// =========================================
 +
 
 +
// load javascript in the footer
 +
add_action('wp_enqueue_scripts', 'add_my_code_37742');
 +
function add_my_code_37742() {
 +
        add_action( 'print_footer_scripts', 'my_footer_script_37742' );
 +
}
 +
 
 +
// Add Javascript to footer
 +
function my_footer_script_37742() { ?>
 +
 
 +
<script type="text/javascript">
 +
 
 +
jQuery(document).ready(function($) {
 +
 
 +
        var menuItems = $("ul#menu-main-menu").children().length;
 +
        var menuWidth = $("ul#menu-main-menu").width();
 +
        var percentage = (menuWidth / menuItems) / (menuWidth / 100);
 +
 
 +
        $("ul#menu-main-menu").children().each(function() {
 +
                $(this).css('width',  percentage + '%');
 +
        });
 +
 
 +
});
 +
 
 +
</script>
 +
 
 +
<?php }
 +
</pre>
 +
 
 +
where <code>menu-main-menu</code> is the ID of custom menu shown in the nav bar.
 +
 
 +
Add the following at the end of child theme's <code>style.css</code> (WP dashboard -> Appearance -> Editor):
 +
 
 +
<pre class="brush: css; gutter: false;">
 +
/*********************************************
 +
    Space out nav bar menu items equally
 +
*********************************************/
 +
 
 +
.builder-module-navigation ul {
 +
width: 100%;
 +
}
 +
 
 +
.builder-module-navigation li a, .builder-module-navigation .current_page_item li a, .builder-module-navigation .current-cat li a {
 +
text-align: center;
 +
}
 +
</pre>
 +
 
 +
Thanks to Ronald. Source: http://ithemes.com/forum/topic/37742-navigation-spread-items-to-length-of-the-nav-bar/#entry173441
 +
 
 +
=== How to add a slow transition effect for second level menus in nav bar ===
 +
 
 +
[http://jsfiddle.net/ronald/nBFm3/ Live Demo]
 +
 
 +
Add the following at the end of child theme's <code>functions.php</code>:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// =========================================
 +
// = Smoothen transition of 2nd level menu =
 +
// =========================================
 +
 
 +
// load javascript in footer
 +
add_action('wp_enqueue_scripts', 'add_my_code_2');
 +
function add_my_code_2() {
 +
add_action( 'print_footer_scripts', 'print_my_footer_scripts_2' );
 +
}
 +
 
 +
// Add required javascript to footer (for delayed opening of subnav)
 +
function print_my_footer_scripts_2() { ?>
 +
 
 +
<script type='text/javascript'>
 +
jQuery(document).ready(function($) {
 +
    $("#menu-main-menu li").hover(function(){
 +
    $(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
 +
    },function(){
 +
    $(this).find('ul:first').css({visibility: "hidden"});
 +
});
 +
 
 +
});
 +
</script>
 +
 
 +
<?php }
 +
</pre>
 +
 
 +
where <code>menu-main-menu</code> is the CSS ID of custom menu (usually <code>&lt;ul id="menu-main-menu"></code>) shown in the nav bar. This is entirely arbitrary, and it is highly unlikely that your selectors are the same. You need to adapt the code accordingly.
 +
 
 +
<u>Alternate Method</u>:
 +
 
 +
Go to My Theme -> Settings -> Analytics and JavaScript Code. Paste the following in the text area under
 +
 
 +
"List any JavaScript or other code to be manually inserted inside the site's <head> tag in the input below."
 +
 
 +
<pre class="brush:php; gutter: false;">
 +
<script type='text/javascript'>
 +
jQuery(document).ready(function($) {
 +
    $("#menu-main-menu li").hover(function(){
 +
    $(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
 +
    },function(){
 +
    $(this).find('ul:first').css({visibility: "hidden"});
 +
});
 +
 
 +
});
 +
</script>
 +
</pre>
 +
 
 +
where <code>menu-main-menu</code> is the CSS ID of custom menu shown in the nav bar.
 +
 
 +
Save settings.
 +
 
 +
 
 +
Thanks to Ronald. Source: http://ithemes.com/forum/topic/30998-is-it-possible-to-add-a-slow-transition-effect-to-the-navbar/#entry144025
 +
 
 +
Another similar forum topic: http://ithemes.com/forum/topic/21002-navigation-with-animated-effect/
 +
 
 +
=== How to Clear Placeholder Text Upon Focus in Gravity Forms Fields ===
 +
 
 +
[http://wordpress.org/extend/plugins/gravity-forms-placeholders/ Gravity Forms - Placeholders add-on] plugin can be used to add HTML5 placeholder support to Gravity Forms' fields with a javascript fallback. <code>gplaceholder</code> CSS class should be added to text fields or textareas as needed, or to the form itself to enable this feature to all fields within it.
 +
 
 +
Ex.:
 +
 
 +
[[File:2013-02-04 20-35-47.png|513px|thumb|none]]
 +
 
 +
Now all Gravity Forms' field labels will appear inside the fields as placeholder text.
 +
 
 +
<gallery>
 +
File:Screen Shot 2013-02-04 at 8.39.24 PM.png|Before
 +
File:Screen Shot 2013-02-04 at 8.39.33 PM.png|After
 +
</gallery>
 +
 
 +
The placeholder text will continue to appear when clicked or tabbed to inside a field, but will disappear when user starts typing.
 +
 
 +
If you would like the fields' placeholder text to be cleared when a field gets focus, add the following at the end of child theme's <code>functions.php</code>:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// =========================================
 +
// = Auto hide placeholder text upon focus =
 +
// =========================================
 +
 
 +
// load javascript in footer
 +
add_action('wp_enqueue_scripts', 'add_my_code_3');
 +
 
 +
function add_my_code_3() {
 +
    add_action( 'print_footer_scripts', 'my_footer_script_3' );
 +
}
 +
 
 +
// Add jQuery to footer
 +
 
 +
function my_footer_script_3() { ?>
 +
    <script type="text/javascript">
 +
        jQuery(document).ready(function($) {
 +
            $('.gform_wrapper').find(':input').each(function() {
 +
                $(this).data('saveplaceholder', $(this).attr('placeholder'));
 +
 
 +
                $(this).focusin(function() {
 +
                    $(this).attr('placeholder', '');
 +
                });
 +
 
 +
                $(this).focusout(function() {
 +
                    $(this).attr('placeholder', $(this).data('saveplaceholder'));
 +
                });
 +
 
 +
            })
 +
        })
 +
    </script>
 +
<?php }
 +
</pre>
 +
 
 +
Thanks to Ronald for providing this code [http://jsfiddle.net/ronald/KfZTp/ here].
 +
 
 +
=== Loading Script in Footer on All Pages Except One ===
 +
 
 +
Ex.:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
/* JMAC script load */
 +
// load jquery and prepare javascript in footer
 +
add_action('wp_enqueue_scripts', 'jmac_scripts_method');
 +
function jmac_scripts_method() {
 +
wp_enqueue_script('jquery');
 +
    add_action('print_footer_scripts', 'jmac_print_footer_scripts');
 +
}
 +
 
 +
// Add required javascript to footer
 +
function jmac_print_footer_scripts() { if(!is_page('videoconferencing')) { ?>
 +
<script type="text/javascript">
 +
jQuery(document).ready(function($) {
 +
function toggleVideo(state) {
 +
    // if state == 'hide', hide. Else: show video
 +
    var div = document.getElementById("popupVid");
 +
    var iframe = div.getElementsByTagName("iframe")[0].contentWindow;
 +
    div.style.display = state == 'hide' ? 'none' : '';
 +
    func = state == 'hide' ? 'pauseVideo' : 'playVideo';
 +
    iframe.postMessage('{"event":"command","func":"' + func + '","args":""}','*');
 +
}
 +
 
 +
});
 +
</script>
 +
<?php
 +
} }
 +
/* JMAC script load end */
 +
</pre>
 +
 
 +
Note: The focus of this wiki entry is not what the jQuery code does, but rather the if conditional used:
 +
 
 +
<code>if(!is_page('videoconferencing'))</code>
 +
 
 +
where "videoconferencing" is the slug of Page in which jQuery code should NOT be loaded.
 +
 
 +
Forum topic: http://ithemes.com/forum/topic/33305-script-in-footer-on-all-pages-except-one/
 +
 
 +
=== Loading Script in Footer Only on Site's Front Page ===
 +
 
 +
Ex.:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// prepare javascript in footer
 +
add_action('wp_enqueue_scripts', 'add_my_script_4');
 +
 
 +
function add_my_script_4() {
 +
add_action( 'print_footer_scripts', 'home_page_only_script' );
 +
}
 +
 
 +
 
 +
// Add javascript to footer
 +
function home_page_only_script() {
 +
    if ( is_front_page() ) : ?>
 +
        <script type="text/javascript">
 +
        //your javascript here...
 +
        </script>
 +
<?php endif;
 +
}
 +
</pre>
 +
 
 +
Thanks to Ronald. Source: http://ithemes.com/forum/topic/33473-adding-javascipt-to-home-page/#entry155302
 +
 
 +
=== How to Create a "Stay-On-Top" element ===
 +
 
 +
Live Demos: [http://ithemes.com/ iThemes.com], [http://webdesign.com/ WebDesign.com]
 +
 
 +
[[File:Parent page Builder Responsive Test Site.png|800px|thumb|none|Standard nav bar]]
 +
 
 +
As the user scrolls down..
 +
 
 +
[[File:2013-02-14 16-52-24.png|800px|thumb|none|As user scrolls below past the standard nav bar, it gets replaced by a nav bar in a fixed position at the top of browser. When user scrolls to top, it goes away]]
 +
 
 +
'''1.''' Identify the selector of the element that you wish to stay on top. Firebug can be used for this.
 +
 
 +
Ex.: <code>.builder-module-navigation-background-wrapper</code> in case of a navigation module.
 +
 
 +
'''2.''' Add the following at the end of child theme's <code>functions.php</code> (before closing PHP tag, if present):
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// =========================================
 +
// = "Stay-On-Top" element =
 +
// =========================================
 +
 
 +
add_action('wp_enqueue_scripts', 'add_my_code');
 +
 
 +
function add_my_code() {
 +
    add_action( 'print_footer_scripts', 'my_footer_script' );
 +
}
 +
 
 +
 
 +
function my_footer_script() { ?>
 +
 
 +
  <script type="text/javascript">
 +
 
 +
    jQuery(function($) {
 +
 
 +
      var filter = $('.builder-module-navigation-background-wrapper');
 +
 
 +
      pos = filter.offset();
 +
 
 +
      var filterSpacer = $('<div />', {
 +
        "class": "filter-drop-spacer",
 +
        "height": filter.outerHeight()
 +
      });
 +
 
 +
      var fixed = false;
 +
 
 +
      $(window).scroll(function() {
 +
 
 +
        if($(this).scrollTop() >= pos.top+filter.height() )
 +
 
 +
          {
 +
            if( !fixed )
 +
              {
 +
                fixed = true;
 +
 
 +
                filter.fadeOut('fast', function() {
 +
                  $(this).addClass('fixed').fadeIn('fast');
 +
                  // $('.search_in_nav, .my-social-icons').hide();
 +
                  $(this).before(filterSpacer);
 +
                  });
 +
              }
 +
          }
 +
 
 +
          else
 +
 
 +
          {
 +
            if( fixed )
 +
              {
 +
                fixed = false;
 +
 
 +
                filter.fadeOut('fast', function() {
 +
                  $(this).removeClass('fixed').fadeIn('fast');
 +
                  // $('.search_in_nav, .my-social-icons').show();
 +
                  filterSpacer.remove();
 +
                });
 +
              }
 +
        }
 +
      });
 +
 
 +
    });
 +
 
 +
  </script>
 +
 
 +
<?php }
 +
</pre>
 +
 
 +
In the above, enter the selector from step 1 in the following line:
 +
 
 +
var filter = $('.builder-module-navigation-background-wrapper');
 +
 
 +
(Optional) If you would like to hide any children of the element in fixed state, specify their selectors in the line below and remove the comment.
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// $('.search_in_nav, .my-social-icons').hide();
 +
</pre>
 +
 
 +
Remember to do similarly in the line below:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
// $('.search_in_nav, .my-social-icons').show();
 +
</pre>
 +
 
 +
'''3.''' Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):
 +
 
 +
<pre class="brush: css; gutter: false;">
 +
.builder-module-navigation-background-wrapper.fixed {
 +
position: fixed;
 +
left: 0;
 +
top: 0;
 +
width: 100%;
 +
 
 +
-webkit-box-shadow: 0 0 40px #222;
 +
-moz-box-shadow: 0 0 40px #222;
 +
box-shadow: 0 0 40px #222;
 +
 
 +
background: rgba(255, 255, 255, 0.92);
 +
z-index: 100;
 +
}
 +
 
 +
.admin-bar .builder-module-navigation-background-wrapper.fixed {
 +
top: 28px;
 +
}
 +
</pre>
 +
 
 +
In the above CSS code, ensure that correct selector is being used.
 +
 
 +
Source: http://www.1stwebdesigner.com/tutorials/create-stay-on-top-menu-css3-jquery/ and http://ithemes.com/wp-content/themes/iThemes2012/js/ui.js
 +
 
 +
== Using a Shortcode in HTML Module for Custom Header ==
 +
 
 +
A user in the forum asked the following:
 +
 
 +
<blockquote>On one of my customer sites (a Builder site), we have many similar, but slightly different layouts. On all of them, we want the same custom header (in a Custom HTML module). I’d like to maintain the HTML for that custom header in one place so that I don’t have to copy and paste the header code into each layout each time I want to make a change.</blockquote>
 +
 
 +
One of the ways this can be done is by creating a shortcode having the HTML code needed to display the custom header image and place this shortcode in HTML module of all the layouts. The advantage of doing so is that should you decide later on to make any changes in the HTML, it has to be done only in one place.
 +
 
 +
'''1.''' Install and activate [http://wordpress.org/extend/plugins/shortcodes-ui/ ShortCodes UI] plugin.
 +
 
 +
'''2.''' Go to Short Codes -> Add New.
 +
 
 +
Enter a descriptive name for the title. This is only for your reference and is not used while executing the shortcode.
 +
 
 +
In the main editor, enter the HTML code needed to display your custom header image.
 +
 
 +
Ex.:
 +
 
 +
<pre class="brush: html; gutter: false;">
 +
<a href="http://localhost/builder3/"><img src="http://localhost/builder-responsive/wp-content/themes/BuilderChild-Default/images/header.jpg" alt="Home" /></a>
 +
</pre>
 +
 
 +
Leave the <code>ShortCode Type</code> setting as <code>Simple Snippet</code>.
 +
 
 +
Enter a ShortCode Tag. This is the string that we place within square brackets to execute/call this shortcode.
 +
 
 +
Click Publish.
 +
 
 +
[[File:Add New Shortcode - Builder Responsive Test Site — WordPress 2013-02-05 20-22-31.png|531px|thumb|none]]
 +
 
 +
Now add a HTML module wherever you want to the custom header image to appear and place the shortcode tag surrounded by square brackets.
 +
 
 +
Ex.: <code>[my_header]</code>
 +
 
 +
[[File:Screen Shot 2013-02-05 at 8.52.00 PM.png|531px|thumb|none]]
 +
 
 +
Output on the webpage:
 +
 
 +
[[File:Screen Shot 2013-02-05 at 8.51.17 PM.png|531px|thumb|none]]
 +
 
 +
As you may probably be thinking, the output can simply be achieved by using a Image module but then it will not have the advantage of "update in one place – change everywhere".
 +
 
 +
Instead of using the plugin, we can write code similar to following in child theme's <code>functions.php</code> to create shortcode and use it as above.
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
//logo in header
 +
add_shortcode('headercontent','getlogo');
 +
function getlogo() {
 +
echo '<div class="headerlogo"><a href="'.get_bloginfo('home').'"><img src="'.get_bloginfo('stylesheet_directory').'/images/company-logo.png" alt="web design" /></a>';
 +
}
 +
</pre>
 +
 
 +
Thanks to Valerie Cudnik for providing the above code [http://pastebin.com/9kXf71bF here].
 +
 
 +
== How to fix positioning problem of event pop up trigger bar of All In One Calendar By Timely ==
 +
 
 +
Applies to plugin version: 1.9
 +
 
 +
[[File:Screen Shot 2013-02-15 at 9.27.01 AM.png|758px|thumb|none|Before]]
 +
 
 +
[[File:Screen Shot 2013-02-15 at 9.21.18 AM.png|7586px|thumb|none|After]]
 +
 
 +
Add the following at the end of child theme's <code>style.css</code> (WP dashboard -> Appearance -> Editor):
 +
 
 +
<pre class="brush: css; gutter: false;">
 +
a.ai1ec-popup-trigger {
 +
    top: 0 !important;
 +
}
 +
 
 +
.timely .hide.ai1ec-popup + a.ai1ec-popup-trigger {
 +
    padding-top: 1em;
 +
}
 +
</pre>
 +
 
 +
Forum topic: http://ithemes.com/forum/topic/38506-all-in-one-calendar-by-timely-builder-conflict/
 +
 
 +
== How to get the output of a Header module in a HTML module ==
 +
 
 +
Using a HTML module gives more control than a Header module in situations like [http://ithemes.com/forum/topic/38496-problem-with-header-module/ this].
 +
 
 +
[[File:Header Module Settings.png|463px|thumb|none]]
 +
 
 +
Output of above Header module can be simulated by using a PHP enabled HTML module having the following code:
 +
 
 +
<pre class="brush: php; gutter: false;">
 +
<?php if (is_front_page()) : ?>
 +
<h1 class="site-title"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
 +
 
 +
<h3 class="site-tagline"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('description'); ?></a></h5>
 +
 
 +
<?php else : ?>
 +
<h3 class="site-title"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
 +
 
 +
<h5 class="site-tagline"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('description'); ?></a></h5>
 +
 
 +
<?php endif; ?>
 +
</pre>

Revision as of 07:28, February 17, 2013

This is Page 2 of Plugin related and other generic customizations in Builder. Here is Page 1.

Contents

How to add social media icons in nav bar

This can be done in at least 2 different ways. The primary difference between method 1 and 2 is that in method 2, left margin for first social icon has to be manually adjusted every time a menu item in the nav bar is changed. For this reason, method 1 is recommended.

Method 1

2012-09-02 12-52-02.png

1. Create (if you haven't already) a custom menu at Appearance -> Menus, which should appear in the nav bar.

2. Instead of a navigation module, use a PHP enabled HTML module having this sample code:

<?php wp_nav_menu( array( 'menu' => 'primary', 'menu_class' => 'builder-module-navigation') ); ?>

<div class="my-social-icons">
<ul>
    <li class="social-icon"><a target="_blank" rel="nofollow" href="http://www.facebook.com/"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="Follow Us on Facebook" alt="Follow Us on Facebook" src="http://ithemes.com/builder/misc/social-media-icons/32/facebook.png"></a></li>
    
    <li class="social-icon"><a target="_blank" rel="nofollow" href="http://twitter.com/#!/"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="Follow Us on Twitter" alt="Follow Us on Twitter" src="http://ithemes.com/builder/misc/social-media-icons/32/twitter.png"></a></li>
    
    <li class="social-icon"><a target="_blank" rel="nofollow" href="http://www.yoursite.com/feed/"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="Follow Us on RSS" alt="Follow Us on RSS" src="http://ithemes.com/builder/misc/social-media-icons/32/rss.png"></a></li>
    
    <li class="social-icon"><a target="_blank" rel="nofollow" href="mailto: admin@yoursite.com"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="E-mail Us" alt="E-mail Us" src="http://ithemes.com/builder/misc/social-media-icons/32/email.png"></a></li>
</ul> 
</div>

Note:

  1. In the above, change primary to the slug of your custom menu. Ex.: If the name of your custom menu is "Main Menu", it slug will be main-menu.
  2. It is recommended to use the social icons from your WordPress site. You should download the icons referred to in the above code, upload them to your site and use those links instead.

3. Add the following sample code at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):

/************************************************************************
    For right floating social icons in a HTML module showing nav bar
*************************************************************************/

.builder-module-2 {
	background: #FAA51B;
}

.menu-primary-container {
	float: left;
}

#menu-primary {
	margin-bottom: 0;
}

li.social-icon a, li.social-icon a:hover {
    padding: 1px 0 0 8px;
}

li.social-icon a:hover {
    opacity: 0.8;
    -moz-opacity: 0.8;
    background: none;
}

li.social-icon:hover,
li.social-icon:hover a {
    background: none;
}

.my-social-icons {
	float: right;
	margin-right: 10px;
	padding-top: 8px;
}

.my-social-icons ul {
	list-style: none;
}

.my-social-icons li {
	float: left;
}

Note: In the above

a) Change the number (2) in .builder-module-2 so it is the module number from top in layout.

b) In

.builder-module-2 {
	background: #FAA51B;
}

replace background: #FAA51B; with child theme's styles set for navigation module or in the case of Thinner, those of .builder-module-navigation ul.menu. i.e.,

.builder-module-2 {
	/*background: #FAA51B;*/
	overflow: hidden;
	background: #F6F6F6;
	background: -webkit-gradient(linear, left top, left bottom, from(#FFFFFF), to(#F6F6F6));
	background: -webkit-linear-gradient(#FFFFFF, #F6F6F6);
	background: -moz-linear-gradient(#FFFFFF, #F6F6F6);
	background: -ms-linear-gradient(#FFFFFF, #F6F6F6);
	background: -o-linear-gradient(#FFFFFF, #F6F6F6);
	background: linear-gradient(#FFFFFF, #F6F6F6);
	border: 1px solid #FFF;
	-webkit-border-radius: 10px;
	-khtml-border-radius: 10px;
	-moz-border-radius: 10px;
	border-radius: 10px;
	-webkit-box-shadow: #AAAAAA 1px 1px 2px;
	-moz-box-shadow: #AAAAAA 1px 1px 2px;
	-o-box-shadow: #AAAAAA 1px 1px 2px;
	-khtml-box-shadow: #AAAAAA 1px 1px 2px;
	box-shadow: #AAAAAA 1px 1px 2px;
}

c) primary to the slug of your custom menu. Ex.: If the name of your custom menu is "Main Menu", it slug will be main-menu.

Method 2

Social-icons-navbar.png

Create (if you haven't already) a custom menu at Appearance -> Menus, which should appear in the nav bar.

1. Edit your child theme's functions.php.

Add the following at the end (before closing PHP tag, if present):

add_filter('wp_nav_menu_main-menu_items','add_images', 10, 2);
function add_images($items, $args) {
 
        $items .= '<li class="social-icon" id="first-social-icon"><a target="_blank" rel="nofollow" href="http://www.facebook.com/"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="Follow Us on Facebook" alt="Follow Us on Facebook" src="http://ithemes.com/builder/misc/social-media-icons/32/facebook.png"></a></li>';
        
        $items .= '<li class="social-icon"><a target="_blank" rel="nofollow" href="http://twitter.com/#!/"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="Follow Us on Twitter" alt="Follow Us on Twitter" src="http://ithemes.com/builder/misc/social-media-icons/32/twitter.png"></a></li>';
        
        $items .= '<li class="social-icon"><a target="_blank" rel="nofollow" href="http://www.yoursite.com/feed/"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="Follow Us on RSS" alt="Follow Us on RSS" src="http://ithemes.com/builder/misc/social-media-icons/32/rss.png"></a></li>';
        
        $items .= '<li class="social-icon"><a target="_blank" rel="nofollow" href="mailto: admin@yoursite.com"><img class="fade" style="opacity: 1; -moz-opacity: 1;" title="E-mail Us" alt="E-mail Us" src="http://ithemes.com/builder/misc/social-media-icons/32/email.png"></a></li>';
        
    return $items;    
}

Note: In the above code, main-menu must be replaced with the slug of your custom menu. Ex.: If the name of your custom menu is Primary Navigation, then

add_filter('wp_nav_menu_main-menu_items','add_images', 10, 2);

must be changed to

add_filter('wp_nav_menu_primary-navigation_items','add_images', 10, 2);

2. Add the following at the end of child theme's style.css and customize it if necessary:

/* Custom Styles For The Social Media Widget Icons in Navigation */

li#first-social-icon {
    margin-left: 355px; /* Adjust this value so the icons are positioned at your desired location. */
}

/* li.social-icon {
    height: 36px;
} */ /* Needed only in certain themes like Traverse */

li.social-icon a, li.social-icon a:hover {
    padding: 1px 0 0 8px;
}

li.social-icon a:hover {
    opacity: 0.8;
    -moz-opacity: 0.8;
    background: none;    
}

li.social-icon:hover,
li.social-icon:hover a {
    background: none;
}

That's it!

This method is also explained here.

Sample implementations:

1. Traverse with round icons:

2011-11-26 10-27-16.png

Forum topic

How to display Posts from a specific category on a Page in Magazine Extension style

Page-mag-style.png

The instructions below outline how to have all posts from a category named Issues (ID = 18) appear on a Page titled Issues List (slug = issues-list).

1. Ensure that pretty permalinks are enabled. Create a Page titled Issues. Do not enter any content in the Page. Just enter the title and publish.

2. Save this code as page-issues-list.php. (i.e., page-<<slug>>.php)

  1. Set a title for this Page in line 12.
  2. Edit the category ID in line 21.

Upload this file to child theme directory.

3. Copy lib directory from parent Builder/extensions/magazine directory into child theme directory.

4. Add this at the end of child theme's style.css.

That's it.

Note: If a layout is applied to this Page, ensure that it (the layout) does not have an extension applied.

How to use CSS3 PIE

PIE stands for Progressive Internet Explorer. It is an IE attached behavior which, when applied to an element, allows IE to recognize and display a number of CSS3 properties.

It is used to get CSS3 properties like border-radius working in IE older than version 9.

Follow the steps below to make CSS3 PIE work in Builder:

Update on July 11, 2012: Builder provides IE browser specific IDs for the html element. These are ie7, ie8 and ie9. It is thus possible to write IE 7, IE 8 and IE 9 specific CSS. This forum topic provides an example where post comment text area (which already has border-radius set in style.css) can be made to show rounded corners in IE 8 using CSS3 PIE. The alternate method listed below also works.

1. Download the latest version of CSS3 PIE from here.

2. Extract the zip flle and upload PIE.htc to any web reachable directory.

Ex.:

public_html/assets/PIE.htc

3. Add position: relative; style to all those selectors for which you would like to use CSS3 PIE. You will of course be specifying border-radius/box-shadow etc. properties (which are supported by CSS3 PIE).

Ex.:

#text-6 {
	-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
position: relative;
}

#text-6 .widget-title {
-moz-border-radius:10px 10px 0px 0px;
-webkit-border-radius:10px 10px 0px 0px;
border-radius:10px 10px 0px 0px;
position: relative;
}

The above CSS is written to make a widget whose ID is text-6 rounded.

Screenshot in Firefox:

Rounded-corners-ff.png

Live Site

4. Add the following in your child theme's functions.php:

function my_render_ie_pie() { ?>
<!--[if lte IE 8]>
<style type="text/css" media="screen">
   #your-css-elements-here { 
          behavior: url('http://www.redkitecreative.com/PIE.htc'); 
    }
</style>

<![endif]-->
<?php
}
add_action('wp_head', 'my_render_ie_pie', 8);

In the above, replace

  1. #your-css-elements-here with CSS selectors for which you have specified CSS 3 properties and for which you would like to use CSS3 PIE.
  2. http://www.redkitecreative.com/PIE.htc with the URL of PIE.htc on your server.

Ex.:

Code in functions.php:

function my_render_ie_pie() { ?>
<!--[if lte IE 8]>
<style type="text/css" media="screen">
   #text-6, #text-6 .widget-title { 
          behavior: url('http://sridhar.internal.ithemes.com/assets/PIE.htc'); 
    }
</style>

<![endif]-->
<?php
}
add_action('wp_head', 'my_render_ie_pie', 8);

Now border-radius property for #text-6 and #text-6 .widget-title will work in IE 8 and below.

Screenshot in IE 8:

Rounded-corners-ie8.png

Note:

  1. This particular example does not render properly in IE 7 probably because of using PIE on an element inside another element. This is the behavior coming from PIE itself and not Builder. Screenshot.
  2. IE 9 supports border-radius natively. So PIE will not be used in IE 9.

That's it!

Source: http://www.position-relative.com/2011/01/using-css3-pie-in-wordpress-custom-themes/

How to set up Shopp in iThemes Builder

Shopp is an e-commerce plugin that adds a feature-rich online store to your WordPress-powered website or blog.

Shopp works out of the box in Builder without the need to edit any template files.

The steps below outline how Shopp can be set up in Builder:

1. After Shopp has been installed and activated, it will create four placeholder pages.

Shopp-placeholder-pages.png

Each of these pages include Shopp-specific shortcodes that are replaced with dynamic content generated by Shopp.

2. Go to Shopp -> Settings, Continue to Shopp Setup...

Go through the various settings and fill them out. Refer to links at the bottom of this page for details on these settings.

3. Presentation Settings:

Make sure you have saved the settings that have been entered in the previous options thus far, if any, before proceeding further.

a) Click on Use Custom Templates button.

b) Create a directory in your active theme (Builder child theme) named shopp. You can either use a FTP client or your hosting cPanel file manager for this.

Creating-shopp-dir-in-child-theme.png

c) Reload the Presentation Settings in the WordPress/Shopp admin and click Install Theme Templates button.

At this point, Shopp will make a copy of the built-in default templates into the newly created shopp directory within your active theme.

d) Tick Enable theme templates and save changes.

4. Now you are ready to add products. Go to Shopp -> Products. Click Add New. Enter the details and save the product.

Products Builder Test Site WordPress 2011-12-03 17-53-00.png

Note: After a product image has been added, if its thumbnail does not appear i.e., if it looks like:

Product-image-missing-thumbnail.png

go to Shopp -> Settings -> System and uncheck Enable Flash-based uploading next to Upload System. Save changes.

You will have to edit the products and add images again.

Screenshots

Shop page (Products listing page)

Shop- -Builder-Test-Site-2011-12-03-18-23-09.jpg

Live Demo: http://sridhar.internal.ithemes.com/shop/ (Dummy site, do not place orders)

Product page

Shop-Catalog-Products-Nike-Men-Downshifter-4-MSL-Black-Sports-Shoes- -Builder-Test-Site-2011-12-03-18-35-09.jpg

Cart page

Cart- -Builder-Test-Site-2011-12-03-18-42-53.jpg


Replay videos of Under the Hood with Shopp training webinar

How to float a div at any position on top of other elements in the container

Screen Shot 2011-12-19 at 10.37.52 PM.png

1. Add the following in child theme's functions.php:

add_action('builder_layout_engine_render_header', 'add_floating_box', 20 );

function add_floating_box() { ?>
	<div id="floating-box-container">
		<div id="floating-box">
			HTML or PHP code comes here
		</div>
	</div>
<?php }

In the above, place the code needed to display your logo (for example) where "HTML code comes here" is present.

2. Add the following at the end of child theme's style.css:

#floating-box-container {
	width: 1000px; /* set this to container (layout) width */
	margin: 0 auto;
	position: relative;
	z-index: 100;
}

#floating-box {
	position: absolute;
	top: 50px;
	left: 0;
	background: yellow;
	width: 200px;
	height: 100px;	
}

In the above, you might want to adjust top, left, background, width and height values.

Screenshot showing the div structure

A practical example of implementing this method can be found here.

Source: http://ithemes.com/forum/topic/28189-where-is-body-tag/page__view__findpost__p__130559

Using Easy Custom Content Types in Builder

Easy Content Types, a commercial plugin provides an extremely easy to use and intuitive interface for creating custom post types, taxonomies, and meta boxes.

Here are some general tips on using Easy Custom Content Types for WordPress in Builder.

1. Do not use Post name permalink structure. Day and name works fine.

2. Go to plugin's settings and tick the first two under "Post Type Templates". You might also want to tick the option under "Taxonomy Templates" if you plan on using custom taxonomy archives.

2012-03-01 10-32-06.png

3. Create your Post Types.

Ex.:

2012-03-01 10-44-56.png

The URL of archive listing of entries from a CPT is: http://yoursite.com/cptslug

Ex.: http://localhost/builder/testimonials/

The URL of single CPT entry is: http://yoursite.com/cptslug/entrytitle

Ex.: http://localhost/builder/testimonials/awesome-service/

4. Check child theme directory using a FTP client or cPanel file manager. If single-<cpt>.php has not been automatically created, copy/upload single.php from parent Builder into the child theme and rename it as single-<cpt>.php.

Ex.:

2012-03-01 10-39-45.png

5. Create any necessary Meta Boxes and Meta Fields.

Ex.:

2012-03-01 10-58-00.png
2012-03-01 10-58-18.png

6. To display Meta Field in template files like single-<cpt>.php, use

<?php												
global $post;												
echo get_post_meta($post->ID, 'ecpt_clienturl', true);
?>

In the above replace "ecpt_clienturl" with the name of your field.

7. To display a Meta Field in LoopBuddy layout, use "Custom Field" tag and enter the field name in "Meta Key" text input.

2012-03-01 11-11-28.png

8. If comments area is not appearing in single CPT entry pages on the site, go to My Theme -> Settings -> Comments. Uncheck the CPT, save settings, re-check it and save settings.

How to show top most (latest) post in full and the others as excerpts

Screenshot: http://d.pr/nfl1

Edit child theme's index.php and any other needed template files like archive.php that output a list of posts.

Replace the the_content() or the_excerpt() function call with the following:

<?php /* Conditional output flag set after first post */ ?>
<?php if($showexcerpt) : ?>
   <?php the_excerpt(); ?>
<?php else: ?>
  <?php the_content(); ?>
<?php endif; ?>
<?php $showexcerpt=true; ?>

Ex.: In Foundation Blank's index.php,

<?php the_content( __( 'Read More→', 'it-l10n-BuilderChild-Foundation-Blank' ) ); ?>

should be replaced with

<?php /* Conditional output flag set after first post */ ?>
							<?php if($showexcerpt) : ?>
							   <?php the_excerpt(); ?>
							<?php else: ?>
							  <?php the_content( __( 'Read More→', 'it-l10n-BuilderChild-Foundation-Blank' ) ); ?>
							<?php endif; ?>
							<?php $showexcerpt=true; ?>

With the above change, the top most (latest) post will be shown in full unless more quick tag, is used. If more quick tag is used, "Read More→" will appear at the cut off point.

Source: http://wordpress.org/support/topic/full-article-for-first-post-excerpts-for-the-rest?replies=7#post-1743222

How to implement Yoast Breadcrumbs in Builder

Yoast Breadcrumbs on WordPress.org

Determine where you want the breadcrumbs to appear and edit the appropriate template file(s) in child theme. Use this image as a reference. If a particular file is not present in the child theme directory, copy it from parent Builder directory.

Generally speaking, these are the files that you will be modifying: page.php (for static Pages), single.php (for single post pages), index.php (for Posts page) and archive.php (for category pages).

Let's consider Kepler child theme as an example and that we want to add breadcrumbs to all Pages.

Edit page.php.

Below

<?php if ( have_posts() ) : ?>

add

<?php if ( function_exists('yoast_breadcrumb') ) {
	yoast_breadcrumb('<p id="breadcrumbs">','</p>');
} ?>

Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):

#breadcrumbs {
    color: #D0ECF3;
    margin-top: 0;
}

#breadcrumbs a {
    color: #FFFFFF;
}

Note: The above CSS code might have to be adjusted depending on the child theme.

This should result in
2012-06-26 21-36-17.png

How to remove hyperlink from tagline in Header module

Add the following code to child theme's functions.php (at the end, but before the closing ?> line, if any):

// load our javascript in the footer
add_action('wp_enqueue_scripts', 'add_my_code');
function add_my_code() {
    add_action( 'print_footer_scripts', 'my_footer_script' );
}  

// Add jQuery to footer
function my_footer_script() { ?>

    <script type="text/javascript">
    jQuery(document).ready(function($) {
            $('.site-tagline a').replaceWith(function() {
                    return this.innerHTML; });
            });

    </script>

<?php }

Thanks to Ronald (forum post)

How to assign layouts to The Events Calendar pages

The Events Calendar plugin enables you to rapidly create and manage events. Features include Google Maps integration as well as default templates such as a calendar grid and event list, widget and so much more.

To assign a layout to all pages generated by this plugin, ex.: http://yoursite.com/events/ add the following in child theme's functions.php before closing PHP tag (if present):

function set_custom_layout( $layout_id ) {
    if ( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() )
            return '4f5363f3cb8e1';

    return $layout_id;
}
add_filter( 'builder_filter_current_layout', 'set_custom_layout' );

In the above replace 4f5363f3cb8e1 with the ID of your desired layout.

Source: http://tri.be/tutorial-integrating-the-events-calendar-w-genesis/

It is also possible to set different layouts to different views like

  • main calendar page
  • calendar category pages
  • single events
  • single event days
  • single venues
  • events or venue pages
  • events list page

by adding more functions similar to the one above.

The needed if conditionals can be obtained from the source linked above.

Jetpack and Builder

Sharing

If you would like to use Jetpack's Sharing Buttons in Widget Content widgets, go to

  1. Settings -> Sharing. Tick Widget Content under "Show buttons on".
  2. My Theme -> Settings -> Widget Content. Select "Use the the_content filter to format Widget Content entries."

Sample screenshot:

Screen Shot 2012-12-07 at 5.22.34 PM.png

How to prevent automatic placement of Jetpack's Share buttons and place them manually

Sample scenario:

1) At WP Dashboard -> Settings -> Sharing,

a) Few services have been enabled by dragging them under "Enabled Services" area.

b) Show buttons on is ticked for "Front Page, Archive Pages, and Search Results".

2) Active theme: Builder Child Theme - Acute Purple - 1.1.0

3) 'Teasers Layout - Image Left' Builder extension is applied to the Posts page with Read More set to appear for all excerpts.

To prevent automatic placement of Jetpack's Share buttons and place them manually, follow this:

1. Add the following at end of child theme's functions.php:

// Remove automatically-inserted Jetpack's share buttons
function jptweak_remove_share() {
	//remove_filter( 'the_content', 'sharing_display',19 );
	remove_filter( 'the_excerpt', 'sharing_display',19 );
}
add_action( 'loop_end', 'jptweak_remove_share' );

Source: http://wordpress.org/support/topic/share-buttons-position-above-other-plugins#post-3686704

2. Wherever you would like to place the Jetpack's Share buttons, edit the appropriate template file and paste the following:

<?php if (function_exists('sharing_display')) echo sharing_display(); ?>

In our sample scenario, the file would be wp-content/themes/BuilderChild-Acute-Purple/extensions/post-teasers-left/functions.php and the above code would be placed below

<?php the_excerpt(); ?>
<p><a href="<?php the_permalink(); ?>" class="more-link">Read More →</a></p>
Screen Shot 2013-01-25 at 8.31.03 PM.png

That's it.

Jetpack Comments

Sample screenshot:

2012-12-07 17-49-39.png
  1. Edit comments.php in active theme (should be a child theme of Builder). If the file is not present, copy it from parent Builder directory into the child theme directory and edit it.

Delete code similar to

<h3><?php comment_form_title( __( 'Leave a Reply', 'it-l10n-BuilderChild-Ionic' ), __( 'Leave a Reply to %s', 'it-l10n-BuilderChild-Ionic' ) ); ?></h3>
		
		<div class="cancel-comment-reply">
			<small><?php cancel_comment_reply_link(); ?></small>
		</div>

and replace

<form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="commentform">
				<?php if ( is_user_logged_in() ) : ?>
					<p class="logged-in-as"><?php printf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'it-l10n-BuilderChild-Ionic' ), admin_url( 'profile.php' ), $user_identity, $logout_url ); ?></p>
				<?php else : ?>
					<p class="comment-form-author">
						<input type="text" name="author" id="author" value="<?php echo esc_attr( $commenter['comment_author'] ); ?>" size="22"<?php echo $aria_req; ?> />
						<label for="author"><small><?php _e( 'Name', 'it-l10n-BuilderChild-Ionic' ); ?> <?php if ( $req ) _e( "<span class='required'>(required)</span>", 'it-l10n-BuilderChild-Ionic' ); ?></small></label>
					</p>
					
					<p class="comment-form-email">
						<input type="text" name="email" id="email" value="<?php echo esc_attr(  $commenter['comment_author_email'] ); ?>" size="22"<?php echo $aria_req; ?> />
						<label for="email"><small><?php _e( 'Mail (will not be published)', 'it-l10n-BuilderChild-Ionic' ); ?> <?php if ( $req ) _e( "<span class='required'>(required)</span>", 'it-l10n-BuilderChild-Ionic' ); ?></small></label>
					</p>
					
					<p class="comment-form-url">
						<input type="text" name="url" id="url" value="<?php echo esc_attr( $commenter['comment_author_url'] ); ?>" size="22" />
						<label for="url"><small><?php _e( 'Website', 'it-l10n-BuilderChild-Ionic' ); ?></small></label>
					</p>
				<?php endif; ?>
				
				<!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
				<p><textarea name="comment" id="comment" cols="45" rows="10"></textarea></p>
				
				<p class="comment-submit-wrapper">
					<input name="submit" type="submit" id="submit" value="<?php _e( 'Submit Comment →', 'it-l10n-BuilderChild-Ionic' ); ?>" />
					<?php comment_id_fields(); ?>
				</p>
				
				<?php do_action( 'comment_form', $post->ID ); ?>
			</form>

with

<?php comment_form(); ?>

Infinite Scroll

Jetpack's Infinite Scroll can either enabled by adding code in child theme's functions.php or simply by just using a plugin.

Details: http://ithemes.com/2012/12/03/builder-jetpack-infinite-scroll/

Carousel

Beginning Builder 4.0.15, Jetpack's Carousel module works fine in iThemes Builder.

Tiled Galleries

JetPack's Tiled Galleries module works in iThemes Builder (v4.0.15 and above) by using a workaround.

Add the following in child theme's functions.php file (after the <?php line):

function custom_disable_builder_gallery() {
    remove_filter( 'post_gallery', 'builder_custom_post_gallery', 10 );
}
add_action( 'builder_theme_features_loaded', 'custom_disable_builder_gallery' );

$content_width = 604;

Note that the $content_width variable has to be set to a value that refers to the pixel width of the area displaying the gallery. The 604 number refers to the total pixel width area of the Default child theme's Content Module without any Layout modifications (960 pixel wide Layout with a 320 pixel wide sidebar). Until a better solution can be found, this variable will have to be manually adjusted so that the gallery properly fills the content area. Fortunately, if you are running a responsive Builder child theme, you can set this value to be larger than required, and it will automatically shrink down (this may work in some non-responsive child themes as well, the results vary).

Set $content_width value to the width of actual content portion (.builder-module-content .builder-module-element) that is available after any padding. Firebug makes it easy to find this.

2013-01-31 11-10-53.png

Source: Builder 4.0.15 release notes.

Limitation: When the above code is used, output of standard gallery shortcode, for example, [gallery ids="1072,1070,1062,1050"] will be affected. This is a known issue for the time being.

How to embed a Gravity Forms form at the bottom of all single posts

2013-02-01 19-34-41.png

1. Go to Forms -> Forms in WP dashboard. Hover mouse on the title of form that you wish to embed and note the number at the end of URL in browser status bar. That would be the form's ID.

2. Edit child theme's single.php. If the child theme does not have this, copy it from parent Builder directory into the child theme directory.

Below

<?php comments_template(); // include comments template ?>

paste

<?php gravity_form(2, true, false, false, '', false); ?>

In the above change 2 to the ID of form you wish to embed.

Source: http://www.gravityhelp.com/documentation/page/Embedding_A_Form

3. Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):

#gform_wrapper_2 {
    margin-top: 4em;
}

In the above change 2 to the ID of form that's embedded.

Examples of Using jQuery in Builder

Disclaimer

iThemes will not be responsible for any issues that may be the result of your attempts to change your site's functions.php file. You do not HAVE to change it. All code samples are for your information, possibly inspiration, and provided "as is". However, when properly implemented, the code samples are accurate and will work.

Warning

If you do not understand what it is you are doing, if the words "php", "opening tag", "FTP", "functions" and "backup" are not familiar to you proceed with caution. You can blow up your site due to invalid code in the functions.php file. Actually, even if you know or think you know it all, it still happens (it happens to me at least once a week - Ronald).

A single missing } or even a , or a semi-colon is all it takes to take your site down. This can be resolved by undoing the changes, however, this can not be done through the wp-dashboard > Appearance > Editor anymore (since your site is down). You then have to restore the functions.php file either through FTP or your hosting cPanel File Manager.

If you think you can not do that, or do not understand what all the above means, I suggest you refrain from editing functions.php.

Should anything go wrong, do not blame the code posted here. The code works. It just needs to be inserted a) the right way, and b) in the right place.

For everyone else feeling confident, and having read the Disclaimer and the paragraph on how to add PHP code to a PHP file, DO MAKE A BACKUP, at least of the file you are editing. It is also not recommended to do these changes through the wp-dashboard > Appearance > Editor. Setup a localhost server on your computer, and use a simple PHP Editor (with syntax checking), ensure that your additions do not break the site and only THEN FTP your files to your server.

How to add PHP code to a PHP file

When adding code to the functions.php file (or any PHP file), make sure it is in PHP format. HTML code is not PHP code, and it WILL break things when coded inside a block of PHP code.

PHP code can be identified by an opening tag: <?php and a closing tag ?>

all code between these tags should be PHP code.

Most WordPress themes have the opening <?php tag in functions.php, coded all the way at the top of the file. Most (Builder Child theme) functions.php files do not have a closing ?> tag (ALL THE WAY) at the end of the file, since it is not required.

So if you add code at the end of your functions.php file, and do so before the closing ?> PHP tag (if any!) you (generally!) are inside a PHP block of code. But this is NOT guaranteed.

  • You can't add html code inside PHP tags.
  • You can't add PHP code outside PHP tags.
  • You can't add opening PHP tags INSIDE a block of PHP code (nesting <?php some php code ?> when there is no closing php tag before it).

Before making the final edits and saving and uploading the file to your server, make sure that the syntax of the entire functions.php is valid syntax. You can do so by using a PHP Editor, and there are online tools such as this one: http://www.piliapp.com/php-syntax-check/

example of correct PHP code

<?php
PHP code
?>

html code

<?php
some more PHP code
?>

example of in correct PHP code 1

<?php
php code

   <?php
   some more php code
   ?>

?>

example of in correct PHP code 2

<?php
html code
?>

example of incorrect PHP code 3

<?php
php code
?>

more php code


Introduction

Please note that code shown is for a particular child theme and for a specific version used when writing the articles. It would usually have to be modified to suit your needs. All code samples use certain selector names (for menus, for builder selectors etc.) This is entirely arbitrary, and it is highly unlikely that your selectors are the same. You have to adapt the code accordingly.

All code samples provided here ASSUME that it will be placed in already existing PHP tags. Therefore, you will not find an opening <?php code at the start, or a closing ?> tag at the end.

How to assign odd and even classes to menu items in nav bar

One typical usage of this would be to set different background colors to alternate menu items.

2013-02-02 21-15-52.png

Add the following at the end of child theme's functions.php:

// Assign even and odd classes to nav bar menu items

add_action('wp_enqueue_scripts', 'add_my_code_1');

function add_my_code_1() {
    add_action( 'print_footer_scripts', 'my_footer_script_1' );
}

function my_footer_script_1() { ?>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
        	$("#menu-main-menu > li:nth-child(odd)").addClass("odd");
        	$("#menu-main-menu > li:nth-child(even)").addClass("even");
        });
    </script>
<?php }

where menu-main-menu is the CSS ID of custom menu shown in the nav bar.

Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):

.builder-module-navigation li.even a {
    background: red;
}

.builder-module-navigation li.odd a {
    background: blue;
}

.builder-module-navigation li.even li a,
.builder-module-navigation li.odd li a {
    background: #FFF;
}

.builder-module-navigation li a:hover,
.builder-module-navigation li.even li a:hover,
.builder-module-navigation li.odd li a:hover {
    background: #333;
    color: #FFF;
}

.builder-module-navigation .current_page_item.even a, .builder-module-navigation .current_page_item.odd a
.builder-module-navigation .current-cat.even a, .builder-module-navigation .current-cat.odd a
.builder-module-navigation .current-menu-item.even a, .builder-module-navigation .current-menu-item.odd a {
	background: #333;
}

.builder-module-navigation li a,
.builder-module-navigation .current_page_item li a,
.builder-module-navigation .current-cat li a {
	color: #FFF;
}

.builder-module-navigation li li a {
    color: #333;
}

Ex.:

Live Demo. Code used on this site: functions.php, style.css.

How to spread/space out menu items equally across the nav bar

Before
After

Add the following at the end of child theme's functions.php:

// =========================================
// = Space out nav bar menu items equally =
// =========================================

// load javascript in the footer
add_action('wp_enqueue_scripts', 'add_my_code_37742');
function add_my_code_37742() {
        add_action( 'print_footer_scripts', 'my_footer_script_37742' );
}

// Add Javascript to footer
function my_footer_script_37742() { ?>

<script type="text/javascript">

jQuery(document).ready(function($) {

        var menuItems = $("ul#menu-main-menu").children().length;
        var menuWidth = $("ul#menu-main-menu").width();
        var percentage = (menuWidth / menuItems) / (menuWidth / 100);

        $("ul#menu-main-menu").children().each(function() {
                $(this).css('width',  percentage + '%');
        });

});

</script>

<?php }

where menu-main-menu is the ID of custom menu shown in the nav bar.

Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):

/*********************************************
    Space out nav bar menu items equally
*********************************************/

.builder-module-navigation ul {
	width: 100%;
}

.builder-module-navigation li a, .builder-module-navigation .current_page_item li a, .builder-module-navigation .current-cat li a {
	text-align: center;
}

Thanks to Ronald. Source: http://ithemes.com/forum/topic/37742-navigation-spread-items-to-length-of-the-nav-bar/#entry173441

How to add a slow transition effect for second level menus in nav bar

Live Demo

Add the following at the end of child theme's functions.php:

// =========================================
// = Smoothen transition of 2nd level menu =
// =========================================

// load javascript in footer
add_action('wp_enqueue_scripts', 'add_my_code_2');
function add_my_code_2() {
	add_action( 'print_footer_scripts', 'print_my_footer_scripts_2' );
}

// Add required javascript to footer (for delayed opening of subnav)
function print_my_footer_scripts_2() { ?>

<script type='text/javascript'>
jQuery(document).ready(function($) {
	    $("#menu-main-menu li").hover(function(){
	    $(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
	    },function(){
	    $(this).find('ul:first').css({visibility: "hidden"});
	});

});
</script>

<?php }

where menu-main-menu is the CSS ID of custom menu (usually <ul id="menu-main-menu">) shown in the nav bar. This is entirely arbitrary, and it is highly unlikely that your selectors are the same. You need to adapt the code accordingly.

Alternate Method:

Go to My Theme -> Settings -> Analytics and JavaScript Code. Paste the following in the text area under

"List any JavaScript or other code to be manually inserted inside the site's <head> tag in the input below."

<script type='text/javascript'>
jQuery(document).ready(function($) {
	    $("#menu-main-menu li").hover(function(){
	    $(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
	    },function(){
	    $(this).find('ul:first').css({visibility: "hidden"});
	});

});
</script>

where menu-main-menu is the CSS ID of custom menu shown in the nav bar.

Save settings.


Thanks to Ronald. Source: http://ithemes.com/forum/topic/30998-is-it-possible-to-add-a-slow-transition-effect-to-the-navbar/#entry144025

Another similar forum topic: http://ithemes.com/forum/topic/21002-navigation-with-animated-effect/

How to Clear Placeholder Text Upon Focus in Gravity Forms Fields

Gravity Forms - Placeholders add-on plugin can be used to add HTML5 placeholder support to Gravity Forms' fields with a javascript fallback. gplaceholder CSS class should be added to text fields or textareas as needed, or to the form itself to enable this feature to all fields within it.

Ex.:

2013-02-04 20-35-47.png

Now all Gravity Forms' field labels will appear inside the fields as placeholder text.

The placeholder text will continue to appear when clicked or tabbed to inside a field, but will disappear when user starts typing.

If you would like the fields' placeholder text to be cleared when a field gets focus, add the following at the end of child theme's functions.php:

// =========================================
// = Auto hide placeholder text upon focus =
// =========================================

// load javascript in footer
add_action('wp_enqueue_scripts', 'add_my_code_3');

function add_my_code_3() {
    add_action( 'print_footer_scripts', 'my_footer_script_3' );
}

// Add jQuery to footer

function my_footer_script_3() { ?>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $('.gform_wrapper').find(':input').each(function() {
                $(this).data('saveplaceholder', $(this).attr('placeholder'));

                $(this).focusin(function() {
                    $(this).attr('placeholder', '');
                });

                $(this).focusout(function() {
                    $(this).attr('placeholder', $(this).data('saveplaceholder'));
                });

            })
        })
    </script>
<?php }

Thanks to Ronald for providing this code here.

Loading Script in Footer on All Pages Except One

Ex.:

/* JMAC script load */
// load jquery and prepare javascript in footer
add_action('wp_enqueue_scripts', 'jmac_scripts_method');
function jmac_scripts_method() {
	wp_enqueue_script('jquery');
    add_action('print_footer_scripts', 'jmac_print_footer_scripts');
}

// Add required javascript to footer
function jmac_print_footer_scripts() { if(!is_page('videoconferencing')) { ?>
	<script type="text/javascript">
		jQuery(document).ready(function($) {
		function toggleVideo(state) {
		    // if state == 'hide', hide. Else: show video
		    var div = document.getElementById("popupVid");
		    var iframe = div.getElementsByTagName("iframe")[0].contentWindow;
		    div.style.display = state == 'hide' ? 'none' : '';
		    func = state == 'hide' ? 'pauseVideo' : 'playVideo';
		    iframe.postMessage('{"event":"command","func":"' + func + '","args":""}','*');
		}

		});
	</script>
<?php
} }
/* JMAC script load end */

Note: The focus of this wiki entry is not what the jQuery code does, but rather the if conditional used:

if(!is_page('videoconferencing'))

where "videoconferencing" is the slug of Page in which jQuery code should NOT be loaded.

Forum topic: http://ithemes.com/forum/topic/33305-script-in-footer-on-all-pages-except-one/

Loading Script in Footer Only on Site's Front Page

Ex.:

// prepare javascript in footer
add_action('wp_enqueue_scripts', 'add_my_script_4');

function add_my_script_4() {
	add_action( 'print_footer_scripts', 'home_page_only_script' );
}


// Add javascript to footer
function home_page_only_script() {
    if ( is_front_page() ) : ?>
        <script type="text/javascript">
        	//your javascript here...
        </script>
	<?php endif;
}

Thanks to Ronald. Source: http://ithemes.com/forum/topic/33473-adding-javascipt-to-home-page/#entry155302

How to Create a "Stay-On-Top" element

Live Demos: iThemes.com, WebDesign.com

Standard nav bar

As the user scrolls down..

As user scrolls below past the standard nav bar, it gets replaced by a nav bar in a fixed position at the top of browser. When user scrolls to top, it goes away

1. Identify the selector of the element that you wish to stay on top. Firebug can be used for this.

Ex.: .builder-module-navigation-background-wrapper in case of a navigation module.

2. Add the following at the end of child theme's functions.php (before closing PHP tag, if present):

// =========================================
// = "Stay-On-Top" element =
// =========================================

add_action('wp_enqueue_scripts', 'add_my_code');

function add_my_code() {
    add_action( 'print_footer_scripts', 'my_footer_script' );
}


function my_footer_script() { ?>

  <script type="text/javascript">

    jQuery(function($) {

      var filter = $('.builder-module-navigation-background-wrapper');

      pos = filter.offset();

      var filterSpacer = $('<div />', {
        "class": "filter-drop-spacer",
        "height": filter.outerHeight()
      });

      var fixed = false;

      $(window).scroll(function() {

        if($(this).scrollTop() >= pos.top+filter.height() )

          {
            if( !fixed )
              {
                fixed = true;

                filter.fadeOut('fast', function() {
                  $(this).addClass('fixed').fadeIn('fast');
                  // $('.search_in_nav, .my-social-icons').hide();
                  $(this).before(filterSpacer);
                  });
              }
          }

          else

          {
            if( fixed )
              {
                fixed = false;

                filter.fadeOut('fast', function() {
                  $(this).removeClass('fixed').fadeIn('fast');
                  // $('.search_in_nav, .my-social-icons').show();
                  filterSpacer.remove();
                });
              }
        }
      });

    });

  </script>

<?php }

In the above, enter the selector from step 1 in the following line:

var filter = $('.builder-module-navigation-background-wrapper');

(Optional) If you would like to hide any children of the element in fixed state, specify their selectors in the line below and remove the comment.

// $('.search_in_nav, .my-social-icons').hide();

Remember to do similarly in the line below:

// $('.search_in_nav, .my-social-icons').show();

3. Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):

.builder-module-navigation-background-wrapper.fixed {
	position: fixed;
	left: 0;
	top: 0;
	width: 100%;

	-webkit-box-shadow: 0 0 40px #222;
	-moz-box-shadow: 0 0 40px #222;
	box-shadow: 0 0 40px #222;

	background: rgba(255, 255, 255, 0.92);
	z-index: 100;
}

.admin-bar .builder-module-navigation-background-wrapper.fixed {
	top: 28px;
}

In the above CSS code, ensure that correct selector is being used.

Source: http://www.1stwebdesigner.com/tutorials/create-stay-on-top-menu-css3-jquery/ and http://ithemes.com/wp-content/themes/iThemes2012/js/ui.js

Using a Shortcode in HTML Module for Custom Header

A user in the forum asked the following:

On one of my customer sites (a Builder site), we have many similar, but slightly different layouts. On all of them, we want the same custom header (in a Custom HTML module). I’d like to maintain the HTML for that custom header in one place so that I don’t have to copy and paste the header code into each layout each time I want to make a change.

One of the ways this can be done is by creating a shortcode having the HTML code needed to display the custom header image and place this shortcode in HTML module of all the layouts. The advantage of doing so is that should you decide later on to make any changes in the HTML, it has to be done only in one place.

1. Install and activate ShortCodes UI plugin.

2. Go to Short Codes -> Add New.

Enter a descriptive name for the title. This is only for your reference and is not used while executing the shortcode.

In the main editor, enter the HTML code needed to display your custom header image.

Ex.:

<a href="http://localhost/builder3/"><img src="http://localhost/builder-responsive/wp-content/themes/BuilderChild-Default/images/header.jpg" alt="Home" /></a>

Leave the ShortCode Type setting as Simple Snippet.

Enter a ShortCode Tag. This is the string that we place within square brackets to execute/call this shortcode.

Click Publish.

Add New Shortcode - Builder Responsive Test Site — WordPress 2013-02-05 20-22-31.png

Now add a HTML module wherever you want to the custom header image to appear and place the shortcode tag surrounded by square brackets.

Ex.: [my_header]

Screen Shot 2013-02-05 at 8.52.00 PM.png

Output on the webpage:

Screen Shot 2013-02-05 at 8.51.17 PM.png

As you may probably be thinking, the output can simply be achieved by using a Image module but then it will not have the advantage of "update in one place – change everywhere".

Instead of using the plugin, we can write code similar to following in child theme's functions.php to create shortcode and use it as above.

//logo in header
add_shortcode('headercontent','getlogo');
function getlogo() {
	echo '<div class="headerlogo"><a href="'.get_bloginfo('home').'"><img src="'.get_bloginfo('stylesheet_directory').'/images/company-logo.png" alt="web design" /></a>';
}

Thanks to Valerie Cudnik for providing the above code here.

How to fix positioning problem of event pop up trigger bar of All In One Calendar By Timely

Applies to plugin version: 1.9

Before
After

Add the following at the end of child theme's style.css (WP dashboard -> Appearance -> Editor):

a.ai1ec-popup-trigger {
    top: 0 !important;
}

.timely .hide.ai1ec-popup + a.ai1ec-popup-trigger {
    padding-top: 1em;
}

Forum topic: http://ithemes.com/forum/topic/38506-all-in-one-calendar-by-timely-builder-conflict/

How to get the output of a Header module in a HTML module

Using a HTML module gives more control than a Header module in situations like this.

Header Module Settings.png

Output of above Header module can be simulated by using a PHP enabled HTML module having the following code:

<?php if (is_front_page()) : ?>
	<h1 class="site-title"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>

	<h3 class="site-tagline"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('description'); ?></a></h5>

<?php else : ?>
	<h3 class="site-title"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>

	<h5 class="site-tagline"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('description'); ?></a></h5>

<?php endif; ?>
Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox