Wednesday, June 27th, 2012 at
7:49 pm
You can use variables within the content block that will be replaced when the block is displayed. For example, if you create a content block, say id=1:
by using the shortcode
when displayed it will appear as My name is John Doe.
This will be useful for developers when iterating through a list of posts or categories, for example, and will provide a reusable template.
More about shortcodes here
Wednesday, June 27th, 2012 at
7:43 pm
WordPress global variables can be used within content blocks, for example,
global $user_login;
global $user_email;
echo “$user_login, you email is: $user_email”;
would output the username and email of the current logged in user, e.g., John, your email is john@youremail.com.
More about global variables: here
Wednesday, June 27th, 2012 at
7:40 pm
You can use standard WordPress shortcodes within a content block.
Simply add the shortcode within a block as normal, for example
to add a WordPress gallery.
Wednesday, June 27th, 2012 at
7:36 pm
To modify the output of content blocks you can add a PHP script to functions.php, for example:
add_filter(‘gcb_block_output’, ‘alter_block_output’);
function alter_block_output($value) {
//process the output here, e.g., convert text to lowercase
$new_value = strtolower($value);
return “Processed output: “.$new_value;
}
will convert the output to lower case.
Wednesday, June 27th, 2012 at
7:33 pm
You can create content blocks with PHP code.
Just copy the PHP as normal into a content block without the <?php, <?, ?> tags and insert the block into your content as normal.
Wednesday, June 27th, 2012 at
7:31 pm
You can use conent blocks outside of posts and pages. Just wrap the shortcode in the PHP function <?php echo gcb(x);?>
where x is the content block ID.
Wednesday, June 27th, 2012 at
7:08 pm
You can nest content blocks within content blocks by adding an existing shortcode within a new one. This can be done either using the HTML editor when creating a new content block or simply using the Insert Global Content Block function within the Visual editor to insert the existing content block within the new one.
Using the Insert Global Content Block function you can even create a new content block while creating another one!
