-
-
Save eri-trabiccolo/14ade3c986e9f3086843 to your computer and use it in GitHub Desktop.
<?php /*Add the following code at the very beginning of your template file, just after the Template declarative block */ ?> | |
<?php | |
// strangely you have to set this to false, typo in the core code. | |
// useful just when you display the page which uses this template in home as static page | |
// consider that the navigation will not work properly (and not because of customizr :P) | |
add_filter('tc_display_customizr_headings', '__return_false'); | |
add_filter('tc_post_list_controller', '__return_true'); | |
// use this to display the page title | |
add_action('__before_loop', 'print_page_title', 0); | |
function print_page_title(){ | |
?> | |
<header class="entry-header"> | |
<h1 class="entry-title "><?php echo get_the_title(); ?></h1> | |
<hr class="featurette-divider __before_content"> | |
</header> | |
<?php | |
} | |
?> | |
<?php /*Append the following code to your child-theme functions.php just if you want to display the page using the template as static page in home */ | |
/* as you can see here I've not used the php starting and closing tags since | |
your functions.php already starts with the first and doesn't have to be closed with the second!*/ ?> | |
// move list headings action | |
add_action('after_setup_theme', 'move_list_headings_action'); | |
function move_list_headings_action(){ | |
if ( class_exists('TC_headings') && method_exists('TC_headings', 'tc_set_post_page_heading_hooks') ){ | |
remove_action( 'wp' , array( TC_headings::$instance , 'tc_set_post_page_heading_hooks') ); | |
add_action( 'wp_head' , array( TC_headings::$instance , 'tc_set_post_page_heading_hooks') ); | |
} | |
} |
and one more thing, dunno if it helps, but also featured pages display customizations are affected by the new grid system. Thoug, again, I must admit that could be me just messing around too much with templates and snippets like this one:
http://themesandco.com/snippet/reordering-featured-page-elements-title-image-text-button/
hope this gives you extra info in the right direction
FYI Rocco,
I'm aware that you are on top of all the regressions after the latest update, but when you select some post formats other than standard, video, gallery there is no output of the title.
I haven't received any notification about these comments Giorgio, sorry :D
About the titles, what do you mean? For some post formats like aside, quote, status, link the title has "never" be shown by default .. look at this from 3.2.15 https://github.com/Nikeo/customizr/blob/v3.2.15/inc/class-fire-init.php#L294
The grid new option, if not selected should not affect other your customizations. Issues are most likely tied to the changes made to the rest of the core code, like in headings, metas, and general post list.
Featured pages costumizations and the grid, cannot reproduce this, what exactly is the problem?
Of course consider that I may have misunderstood everything you said :D
p.s.
my last review of this:
~ line 36:
replace this:
self::$instance =& $this;
with this:
parent::$instance =& $this;
this to ensure you can still access TC_post_list::$instance, also with the modded class
new version, add inline post list style
Cool,
is it going to be integrated in the core files this patch at some point? just to know if I have to keep-up with the code evolution here
Look that I made an error adding the inline style, now fixed.
For now just the filter part has been integrated. The other part (re-hooking) needs a further
investigation :D
Giorgio we're close to a solution for this in the core ;)
probably, keep finger crossed.
p.s.
thanks for that post about json-rest-api really interesting.. :D
Another mod version,
all the "issues" have been fixed in Customizr 3.3.12 and Customizr-Pro 1.0.16
Hey Rocco, I know this is not the place where to follow up / ask about custom loops (I will eventually post it on the forum when solved).
I have this problem, I don't seem to be able to filter a query for CPT with custom taxonomy; I have a CPT called 'publication' and a CT called 'publication-types'; under 'publication-types' I created some categories and one of those is called 'reports'.
I'm trying to filter in a custom loop 2 posts out of 'reports' only: http://www.firstcall.workingdesign.ca/publication-types/reports/ and in the future I will try to have 2 loops filtering also another category called 'letters', but for the sake of the question let's consider only 'reports'.
Here is the code I'm trying to put in my page template:
<!-- custom loop 1 -->
<?php
add_filter('tc_show_post_metas', '__return_true');
global $wp_query, $wp_the_query;
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$wp_query = new WP_Query( array(
'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
'post_type' => 'publication',
'publication-types' => $term->taxonomy,
'reports' => $term->slug,
'post_status' => 'publish',
'posts_per_page' => 2, //show n posts
//'cat' => 77, //include this category from the posts list
//'tag_id' => '77',
//'tag' => 'reports',
//'page_name' => 'publication-s',
//'taxonomy' => 'publication-types',
//'category_name' => 'reports',
//'page_name' => 'publication-types/reports',
//others parameters here: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
) );
?>
<!-- Customizr Loop here -->
<!-- reset the main query -->
<?php $wp_query = $wp_the_query; ?>
well, it does not work because I'm missing the point, it outputs only the 2 most recent posts under 'publication', what am I missing && || doing wrong?
https://github.com/giorgioriccardi/filtering-cpt-and-ct-in-WP-customizr-theme/blob/master/publications-page.php#L58
Hi Rocco,
I'll move the question to the forum, maybe somebody else has already a solution for this
Hey Rocco, problem solved:
https://github.com/giorgioriccardi/filtering-cpt-and-ct-in-WP-customizr-theme/blob/master/publications-page.php#L64
I was missing the part 'tax_query'... so many new things in WP all the time:
https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
this is a working custom loop that filters CPT, CT and related category:
<!-- custom loop 1 -->
<?php
add_filter('tc_show_post_metas', '__return_true'); //this applies only to Customizr theme
global $wp_query, $wp_the_query;
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$wp_query = new WP_Query( array(
'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
'post_type' => 'publication',
'tax_query' => array( //https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
array(
'taxonomy' => 'publication-types',
'field' => 'slug',
'terms' => 'reports',
)
),
'post_status' => 'publish',
'posts_per_page' => 2, //show n posts
//'cat' => 77, //include this category from the posts list
//others parameters here: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
) );
?>
Ciao
Hello Giorgio,
sorry for haven't replied, I don't get notified about new comments on gists.. do you know I could I? :D
This works for me, many thanks;
though it is bit painful the latest release of Customizr-Pro.
Since the new grid layout option has been implemented, it cracked all my bad customizations... I guess I'll have to follow better practicese and guide lines to avoid major problems.
Let's see how it goes with the next versions...