Builder Blocks

From IThemes Codex
Revision as of 06:24, October 29, 2011 by Ronald (Talk | contribs)
Jump to: navigation, search

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:

Function

/*
 * 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 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' );
Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox