Builder Blocks

(Difference between revisions)
Jump to: navigation, search
Line 24: Line 24:
 
</pre>
 
</pre>
 
Note, replace {current_slug} and {new_slug}, example:
 
Note, replace {current_slug} and {new_slug}, example:
====Function====
 
 
<pre class="brush:php">
 
<pre class="brush:php">
 
/*
 
/*
Line 47: Line 46:
 
* sermon_tag
 
* sermon_tag
 
* staff_positions
 
* staff_positions
 +
====Function====
 
<pre class="brush:php">
 
<pre class="brush:php">
 
function custom_change_{current_slug}_slug( $settings ) {  
 
function custom_change_{current_slug}_slug( $settings ) {  
Line 55: Line 55:
 
add_filter( 'it_custom_taxonomy_{current_slug}_filter_settings', 'custom_change_{current_slug}_slug' );
 
add_filter( 'it_custom_taxonomy_{current_slug}_filter_settings', 'custom_change_{current_slug}_slug' );
 
</pre>
 
</pre>
 +
Replace {current_slug} and {new_slug}.

Revision as of 06:26, October 29, 2011

Contents

Frequently Asked Questions

How can I change the page slug created by the Block plugins?

Builder 3.3 has added the functionality which allows you to override the default page slugs used by the Builder Blocks. These functions need to be added at the end of the child themes functions.php, before the closing ?> (if any).

Function to change the page slug for the custom post types

Builder Block Restaurant uses the following Custom Post Types

  • restaurant_menu_item
  • restaurant_location

Builder Block Church uses the following Custom Post Types

  • sermon
  • staff

Function

/*
 * Change the Slug from "{current_slug}" to "{new-slug}"
 * 
 */
function custom_change_{current_slug}_slug( $settings ) { 
    $settings['rewrite']['slug'] = '{new-slug}';
 
    return $settings;
}
add_filter( 'it_custom_post_type_{current_slug}_filter_settings', 'custom_change_{current_slug}_slug' );

Note, replace {current_slug} and {new_slug}, example:

/*
 * Change the Slug from "staff" to "members"
 * 
 */
function custom_change_staff_slug( $settings ) { 
    $settings['rewrite']['slug'] = 'members';
 
    return $settings;
}
add_filter( 'it_custom_post_type_staff_filter_settings', 'custom_change_staff_slug' );

Function to change the page slug for taxonomies

Builder Block Restaurant uses the following Taxonomies

  • restaurant_feature
  • restaurant_cuisine
  • restaurant_course
  • restaurant_allergy

Builder Block Church uses the following Taxonomies

  • sermon_category
  • sermon_tag
  • staff_positions

Function

function custom_change_{current_slug}_slug( $settings ) { 
    $settings['rewrite']['slug'] = '{new_slug}';
 
    return $settings;
}
add_filter( 'it_custom_taxonomy_{current_slug}_filter_settings', 'custom_change_{current_slug}_slug' );

Replace {current_slug} and {new_slug}.

Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox