Filters

Robert Windisch edited this page Jul 25, 2015 · 1 revision

xtreme_hide_columns

Filter for Hiding/Showing xtreme_columns.

/**
 * @param        Boolean $hide_me
 * @param        String $template
 * @return        Integer $hide_me
*/
function xtreme_demo_filter_xtreme_hide_columns( $hide_me, $template ) {
        if( $template === 'my_custom_template' ) {
                $hide_me = true
        }
        return $hide_me;
}
add_filter( 'xtreme_hide_columns', 'xtreme_demo_filter_xtreme_hide_columns' );

xtreme_author_avatar_size

This filter allows you to customize the avatar size.

/**
 * @param        Integer $size
 * @return        Integer $size
*/
function xtreme_demo_filter_xtreme_author_avatar_size( $size ) {
        return 120;        
}
add_filter( 'xtreme_author_avatar_size', 'xtreme_demo_filter_xtreme_author_avatar_size' );

xtreme_authorbox_avatar_size

This filter allows you to customize the avatar size in the author box.

/**
 * @param        Integer $size
 * @return        Integer $size
*/
function xtreme_demo_filter_xtreme_authorbox_avatar_size( $size ) {
        return 75;
}
add_filter( 'xtreme_authorbox_avatar_size', 'xtreme_demo_filter_xtreme_authorbox_avatar_size' );

xtreme_attachment_size

This filter is executed in the loop-attachment template and allows you to change the size of the wp_get_attachment_image().

/**
 * @param        String $size
 * @return        String $size
*/
function xtreme_demo_filter_xtreme_attachment_size( $size ) {
        return 'my_custom_size';
}
add_filter( 'xtreme_attachment_size', 'xtreme_demo_filter_xtreme_attachment_size' );

xtreme_loop_thumbnail_size

This filter allows you to customize the size of the thumbnail outside of the content template in the loop.

/**
 * @param        String $size
 * @return        String $size
*/
function xtreme_demo_filter_xtreme_loop_thumbnail_size( $size ) {
        return 'my_custom_size';
}
add_filter( 'xtreme_loop_thumbnail_size', 'xtreme_demo_filter_xtreme_loop_thumbnail_size' );

xtreme_loop_thumbnail_align

This filter allows you to manipulate the alignment of the thumbnail in the loop.

/**
 * @param        String $align
 * @return        String $align
*/
function xtreme_demo_filter_xtreme_loop_thumbnail_align( $align ) {
        return '';
}
add_filter( 'xtreme_loop_thumbnail_align', 'xtreme_demo_filter_xtreme_loop_thumbnail_align' );

xtreme_loop_templatename

The filter xtreme_loop_templatename allows you to change the template name for the post templates.

/**
 * @param        String $templatename
 * @return        String $templatename
*/
function xtreme_demo_filter_xtreme_loop_templatename( $templatename ) {
        if( /* something happens */ ) {
                $templatename = 'my_special_template';
        }
        return $templatename;
}
add_filter( 'xtreme_loop_templatename', 'xtreme_demo_filter_xtreme_loop_templatename');

xtreme_script_mobilefish

This filter lets you expand or modify the script embedding of mobilefish.js. The script of mobilefish() is transferred as parameter.

/**
 * @param        String $script
 * @param        String $nav
 * @return        String $script
*/
function xtreme_demo_filter_xtreme_script_mobilefish( $script, $nav ) {
        if( $nav === 'primary' )
                // do something
        else if( $nav === 'secondary' )
                // do something else
        /* do somethinge with, before, after the javascript */
        return $script;
}
add_filter( 'xtreme_script_mobilefish', 'xtreme_demo_filter_xtreme_script_mobilefish', 10, 2 );

xtreme_script_superfish

This filter lets you expand or modify the script embedding of superfish.js. The script of superfish() is transferred as parameter.

/**
 * @param        String $script
 * @param        String $nav
 * @return        String $script
*/
function xtreme_demo_filter_xtreme_script_superfish( $script, $nav ) {
        if( $nav === 'primary' )
                // do something
        else if( $nav === 'secondary' )
                // do something else
        /* do somethinge with, before, after the javascript */
        return $script;
}
add_filter( 'xtreme_script_superfish', 'xtreme_demo_filter_xtreme_script_superfish', 10, 2 );

xtreme_after_layout_css

This filter allows you to add or delete additional style sheets according to layout.css. This files are combined in the production(-min).css.

/**
 * @param        Array $stylesheets
 * @return        Array $stylesheets
*/
function xtreme_demo_filter_xtreme_after_layout_css( Array $stylesheets ) {
        $stylesheets[] = '/css/screen/name_des_neuen_stylesheets.css';
        return $stylesheets;
}
add_filter('xtreme_after_content_css', 'xtreme_demo_filter_after_layout_css');

xtreme_demo_filter_xtreme_after_layout_css

This filter allows you to add or delete additional style sheets according to layout.css, gray-theme.css and content.css. This files are combined in the production(-min).css.

/**
 * @param        Array $stylesheets
 * @return        Array $stylesheets
*/
function xtreme_demo_filter_xtreme_after_content_css( Array $stylesheets ) {
        $stylesheets[] = '/css/screen/name_des_neuen_stylesheets.css';
        return $stylesheets;
}
add_filter('xtreme_after_content_css', 'xtreme_demo_filter_xtreme_after_content_css');

after_theme_css

This filter allows you to add or delete additional style sheets according to layout.css, gray-theme.css, content.css und theme.css. This files are combined in the production(-min).css.

/**
 * @param        Array $stylesheets
 * @return        Array $stylesheets
*/
function xtreme_demo_filter_after_theme_css( Array $stylesheets ) {
        $stylesheets[] = '/css/screen/name_des_neuen_stylesheets.css';
        return $stylesheets;
}
add_filter('after_theme_css', 'xtreme_demo_filter_after_theme_css');

xtreme_post_pagination

This filter allows you to customize the page links again before they are displayed.

/**
 * @param        Array $page_links
 * @return        Array $page_links
*/
function xtreme_demo_filter_xtreme_post_pagination( Array $page_links ) {
        /* manipulate the page links */
        return $page_links;
}
add_filter(
        'xtreme_post_pagination',
        'xtreme_demo_filter_xtreme_post_pagination'
);

xtreme_post_titles_args

This filter allows you to change the following parameters for the xtreme_post_titles:

  • order ASC || DESC
  • headline_tag h2
  • headline_link true || false
  • subtitle_tag h4
  • subtitle_link true || false
/**
 * @param        Array $defaults
 * @return        Array $defaults
*/
function xtreme_demo_filter_xtreme_post_titles_args( Array $defaults ) {
        $defaults[ 'order' ] = 'DESC';
        $defaults[ 'subtitle_tags' ] = 'span';
        return $defaults;
}
add_filter(
        'xtreme_post_titles_args',
        'xtreme_demo_filter_xtreme_post_titles_args'
);

xtreme_allowed_tags_post_headline

This filter allows you to add or delete valid HTML tags for the post headline.

/**
 * @param        Array $default_allowed_tags
 * @return        Array $default_allowed_tags
*/
function xtreme_demo_filter_xtreme_widget_allowed_tags_post_headline( Array $default_allowed_tags ) {
        $default_allowed_tags[] = 'span';
        $default_allowed_tags[] = 'cite';
        return $default_allowed_tags;
}
add_filter(
        'xtreme_widget_allowed_tags_post_headline',
        'xtreme_demo_filter_xtreme_widget_allowed_tags_post_headline'
);

xtreme_allowed_tags_post_subtitle

This filter allows you to add or delete valid HTML tags for the post sub-headline.

/**
 * @param        Array $default_allowed_tags
 * @return        Array $default_allowed_tags
*/
function xtreme_demo_filter_xtreme_widget_allowed_tags_post_subtitle( Array $default_allowed_tags ) {
        $default_allowed_tags[] = 'span';
        $default_allowed_tags[] = 'cite';
        return $default_allowed_tags;
}
add_filter(
        'xtreme_widget_allowed_tags_post_subtitle',
        'xtreme_demo_filter_xtreme_widget_allowed_tags_post_subtitle'
);

xtreme_widget_allowed_tags_post_headline

This filter allows you to add or delete valid HTML tags for the widget title in the sub-bar.

/**
 * @param        Array $default_allowed_tags
 * @return        Array $default_allowed_tags
*/
function xtreme_demo_filter_xtreme_widget_allowed_tags_post_headline( Array $default_allowed_tags ) {
        $default_allowed_tags[] = 'span';
        $default_allowed_tags[] = 'cite';
        return $default_allowed_tags;
}
add_filter(
        'xtreme_widget_allowed_tags_post_headline',
        'xtreme_demo_filter_xtreme_widget_allowed_tags_post_headline'
);

xtreme_widget_allowed_tags_post_subtitle

This filter allows you to add or delete valid HTML tags for the widget subtitle in the sub-bar.

/**
 * @param        Array $default_allowed_tags
 * @return        Array $default_allowed_tags
*/
function xtreme_demo_filter_xtreme_widget_allowed_tags_post_subtitle( Array $default_allowed_tags ) {
        $default_allowed_tags[] = 'span';
        $default_allowed_tags[] = 'cite';
        return $default_allowed_tags;
}
add_filter(
        'xtreme_widget_allowed_tags_post_subtitle',
        'xtreme_demo_filter_xtreme_widget_allowed_tags_post_subtitle'
);

xtreme_sidebar_widget_start_tag_attributes

Filter for adding attributes to the sidebar

/**
 * @param        Array $attributes
 * @return        Array $attributes
*/
function xtreme_demo_filter_xtreme_sidebar_widget_start_tag_attributes( Array $attributes ) {
        $attributes[ 'id' ] = 'my-unique-id';
        return $attributes;
}
add_filter(
        'xtreme_sidebar_widget_start_tag_attributes',
        'xtreme_demo_filter_xtreme_sidebar_widget_start_tag_attributes'
);

xtreme_html_tag_classes

This filter allows you to add additional classes to the tag.

/**
 * @param        Array $classes
 * @return        Array $classes
*/
function xtreme_demo_filter_xtreme_html_tag_classes( Array $classes ) {
        $classes[] = 'my_unique_class_name';
        return $classes;
}
add_filter( 'xtreme_html_tag_classes', 'xtreme_demo_filter_xtreme_html_tag_classes' );

xtreme_metaboxes_default

This filter allows you to add additional metaboxes under “Xtreme One” -> “Settings”. **Notice: The Class-Name of your Metabox has to start with the xc_-Prefix.

/**
 * @param        Array        $metaboxes
 * @return        Array
*/
function xtreme_demo_filter_xtreme_metaboxes_default( Array $metaboxes ) {
        $metaboxes[] = 'xc_demo_metabox'; /* class_name */
        return $metaboxes;
}
add_filter( 'xtreme_metaboxes_default', 'xtreme_demo_filter_xtreme_metaboxes_default');

Define Metabox:

class xc_demo_metabox extends xc_base {

        function __construct( &$owner ) {

                parent::__construct(
                        $owner,
                        get_class($this),
                        'Demo Metabox'
                );
                $this->options[] = new xtreme_option_bool(
                        $this,
                        false,
                        'demo_metabox',
                        'Demo Metabox Label:',
                        false
                );
        }
}

These available options can be found under /admin/includes/xtreme-options.php:

  • xtreme_option_measures
  • xtreme_option_numeric
  • xtreme_option_textfield
  • xtreme_option_textarea
  • xtreme_option_description
  • xtreme_option_hidden
  • xtreme_option_bool
  • xtreme_option_switcher
  • xtreme_option_select
  • xtreme_option_select_pair
  • xtreme_option_select_optgroup
  • xtreme_option_locate_files

xtreme_metaboxes_layout

This filter allows you to add additional metaboxes under “Xtreme One” -> “Layout” -> “Create Layout”

<?php
    /**
    * @param        Array        $metaboxes
    * @param        Xtreme_Layouts $obj
    * @return        Array
    */
    function xtreme_demo_filter_xtreme_metaboxes_layout( Array $metaboxes, Xtreme_Layouts $obj ) {
        $metaboxes[] = 'demo_metabox';
        return $metaboxes;
    }
    add_filter( 'xtreme_metaboxes_layout', 'xtreme_demo_filter_xtreme_metaboxes_layout');

Define Metabox:

See “Define Metabox:” in filter xtreme_metaboxes_default.**

Deutsch / German

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.