The SEO extension doesn’t have any functionality that is reflected visually in the front end. It offers additional functionality for its sub-extensions, like Tags module.
In order to keep all sub-extensions options together, the SEO extension creates special options sections in:
general
, the seo section will appear as a sub tab for that box, in other cases it creates a new box.All the filters have the same functionality, the only differences is where they add options.
fw_ext_seo_admin_options
- use to add your own tab in Settings Options SEO tab.
fw_ext_seo_general_tab_admin_options
- use to add your own box in Settings Options SEO > General tab.
fw_ext_seo_general_setting_admin_options
- use to add your own options in Settings Options SEO > General > General Settings box.
fw_ext_seo_post_type_options
- add options in post options SEO box.
fw_ext_seo_taxonomy_options
- add options in term options SEO section.
All filters have the same parameter
$options
array./** * @internal */ function _filter_set_my_framework_titles_metas_tab( $options ) { $options['my_id_tab'] = array( 'title' => __( 'My Options', 'fw' ), 'type' => 'tab', 'options' => array( 'my_id_title' => array( 'label' => __( 'Title', 'fw' ), 'desc' => __( 'Set title', 'fw' ), 'type' => 'text', 'value' => '' ), 'my_id_description' => array( 'label' => __( 'Description', 'fw' ), 'desc' => __( 'Set description', 'fw' ), 'type' => 'textarea', 'value' => '' ), ) ); return $options; } add_filter( 'fw_ext_seo_admin_options', '_filter_set_my_framework_titles_metas_tab' );
The SEO extension has a list of built in SEO tags, but in some cases you’ll want to add your own. To add a new SEO tag you have to use the fw_ext_seo_init_tags
filter. This is the format for a SEO tag:
'tag_name' => array(
'desc' => __( 'My new tag', 'fw' ),
'value' => '',
)
tag_name
must be unique. This tag will be available as %%tag_name%%
.
/**
* @internal
*/
function _filter_add_my_seo_tag($tags) {
$tags['mytag'] = array(
'desc' => __( 'My new tag', 'fw' ),
'value' => '',
);
return $tags;
}
add_filter( 'fw_ext_seo_init_tags', '_filter_add_my_seo_tag' );
The seo tags are created when the extension is initialized,
in some cases you cannot know the value of the tag in the current state, like %%title%%
tag.
So in fw_ext_seo_init_tags
filter, you can add the tag without value,
and define the value after the current page location is defined, by using the fw_ext_seo_update_tags
filter.
/**
* @internal
*/
function _filter_update_my_seo_tag( $tags ) {
if ( isset($tags['mytag']) && is_front_page() ) {
$tags['mytag']['value'] = __('Home', 'fw');
}
return $tags;
}
add_filter( 'fw_ext_seo_update_tags', '_filter_update_my_seo_tag' );