Jump to content


Singular Custom Post Type Pages & is_pagelines_special()

Submitted by Evan Mattson on 23 November 2012 - 04:19 AM

#66ploption


Fixed   Add Issue 

Evan Mattson

Issue Timeline

  • Simon_P updated issue fixed in to 2.3.6

    26 November 2012 - 07:39 PM

  • Simon_P updated issue severity to Fixed

    26 November 2012 - 07:39 PM

  • Simon_P updated issue severity to Unconfirmed

    26 November 2012 - 03:24 AM

As it is, singular posts of a custom post type are not retrieving their saved values from the special page settings array.

I've narrowed this down to the is_pagelines_special function in includes/library.functions.php.  This function does not identify a singular custom post type as "special" & thus doesn't return values even if they are found from plspecial.

Simply adding the pl_is_cpt() function to the first list of conditions will remedy this:

 if ( is_404() || is_home() || is_author() || is_search() || is_archive() || is_category() || is_tag() || pl_is_cpt() )

(is_category, is_tag, & is_author aren't necessary as they are covered by is_archive)

I would also propose that the page types that the passed $args['type'] is checked against is filterable.  Maybe the return value too?

Here's my proposed revision: http://paste.pagelines.com/9ym

or look at this ugly stuff below:
 

/**
 * is_pagelines_special() REVISED
 *
 * A few conditional functions that were being used were unnecessary
 * (is_author, is_category, & is_tag) as these are all covered by is_archive
 * 
 * $special_types should be a filterable array to allow ploption to be used for extended special option values,
 * or anytime the passed $args['type'] would be used/compared (in admin)
 * 
 * Filterable return value - could be used for example to return false for the blog home,
 * letting the page meta values take precedence instead of the special.  Just a thought.
 *
 */
function is_pagelines_special( $args = array() ) {

$special_types = apply_filters( 'pagelines_special_types', array('posts','archive','category','search','tag','author','404_page') );

if ( is_404() || is_home() || is_search() || is_archive() || pl_is_cpt() ) 
$special = true;

elseif ( isset( $args['type'] ) && in_array( $args['type'], $special_types ) )    
$special = true;

elseif ( pl_is_integration() )
$special = true;

else 
$special = false;

return apply_filters( 'is_pagelines_special', $special, $args );
}

Comments


TracDown © 2013 Michael Burton
Click to return to top of page in style!