All posts in Posts

Post with some shortcodes example

It enables plugin developers to create special kinds of content (e.g. forms, content generators) that users can attach to certain pages by adding the corresponding shortcode into the page text.

The API handles all the tricky parsing, eliminating the need for writing a custom regular expression for each shortcode. Helper functions are included for setting and fetching default attributes. The API supports both self-closing and enclosing shortcodes.

Shortcodes are written by providing a handler function. Shortcode handlers are broadly similar to WordPress filters: they accept parameters (attributes) and return a result (the shortcode output).

Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.

The `add_shortcode()` function is used to register a shortcode handler. It takes two parameters: the shortcode name (the string used in a post body), and the callback function name.

Three parameters are passed to the shortcode callback function. You can choose to use any number of them including none of them.

Buttons

LightAquaBlueGreenGreyRedOrangePurpleTeal

Iconboxes

Group

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse scelerisque facilisis neque ut pulvinar.

Speech Bubbles

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse scelerisque facilisis neque ut pulvinar.

 

Top

Post with custom sidebar

The return value should be used to determine whether to display a static sidebar. This ensures that your theme will look good even when the Widgets plug-in is not active.

If your sidebars were registered by number, they should be retrieved by number. If they had names when you registered them, use their names to retrieve them.

Usage

 <?php dynamic_sidebar( $index ); ?> 

Parameters

index
(integer/string) (optional) Name or ID of dynamic sidebar.

Default: 1

Return Value

(boolean) 
True, if widget sidebar was found and called. False if not found or not called.

Examples

Here is the recommended use of this function:

<ul id="sidebar">
<?php if ( !dynamic_sidebar() ) : ?>
   <li>{static sidebar item 1}</li>
   <li>{static sidebar item 2}</li>
<?php endif; ?>
</ul>
<ul id="sidebar">
   <?php dynamic_sidebar( 'Right Sidebar' ); ?>
</ul>

in the “Twenty Ten” theme (3.0+)

Multiple Sidebars

You can load a specific sidebar by either their name (if given a string) or ID (if given an integer). For example,dynamic_sidebar('top_menu') will present a sidebar registered withregister_sidebar(array('name'=>'top_menu',)).

Using ID’s ( dynamic_sidebar(1) ) is easier in that you don’t need to name your sidebar, but they are harder to figure out without looking into your functions.php file or in the widgets administration panel and thus make your code less readable. Note that ID’s begin at 1.

If you name your own ID values in the register_sidebar() WordPress function, you might increase readability of the code. The ID should be all lowercase alphanumeric characters and not contain white space. You can also use the - and _ characters. IDs must be unique and cannot match a sidebar name. Using your own IDs can also make the sidebar name translatable.

// See the __() WordPress function for valid values for $text_domain.
register_sidebar( array(
    'id'          => 'top-menu',
    'name'        => __( 'Top Menu', $text_domain ),
    'description' => __( 'This sidebar is located above the age logo.', $text_domain ),
) );

This allows the use of dynamic_sidebar( 'top-menu' ) which uses an ID and is readable.

Top
Page 1 of 1