Medesko
Forum Replies Created
-
Forum: Hacks
In reply to: get_previous_post in two categorieHi ,
Thanks for your explain.I followed your explanation and work perfectly! here is my code !
Thank for code quality checking!
`
function custom_get_xxx_post_where($whereSql) {
global $custom_get_xxx_post_where;
if(isset($custom_get_xxx_post_where) === true AND $custom_get_xxx_post_where === true) {
if($_SESSION[‘cat_name’] == ‘dsi’) {
$whereSql .= ‘ AND tt.term_id = 2 ‘;
} else if($_SESSION[‘cat_name’] == ‘metiers’) {
$whereSql .= ‘ AND tt.term_id = 3 ‘;
}
}
return $whereSql;
};
add_filter(‘get_previous_post_where’, ‘custom_get_xxx_post_where’);
add_filter(‘get_next_post_where’, ‘custom_get_xxx_post_where’);<?php
$custom_get_xxx_post_where = true;
previous_post_link(‘<div class=”dossier-control hidden-sm hidden-xs”> %link</div>’, ‘Prev’, true);
next_post_link(‘<div class=”dossier-control hidden-sm hidden-xs”>%link</div>’, ‘Next’, true);
$custom_get_xxx_post_where = false;
?>
`Forum: Themes and Templates
In reply to: the pagination links simply don't show up. please help meThank you it works well now
Forum: Themes and Templates
In reply to: the pagination links simply don't show up. please help me[Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
Forum: Fixing WordPress
In reply to: Sidebar to Modele category and childHello It work now in Archives.php
I juste change your condition Thank u so much
the code is<?php // Check category and parent category for matching sidebar $cat_id = get_query_var('cat'); // Get ID of current category $cat_term = get_term_by( 'id', $cat_id, 'category' ); // Use ID to get category data $cat_slug = $cat_term->slug; // Get category slug from data $cat_parent_id = $cat_term->parent; // Get parent category ID from data $cat_parent_term = get_term_by( 'id', $cat_parent_id, 'category' ); // Use ID to get parent category data $cat_parent_slug = $cat_parent_term->slug; // Get parent category slug from data if(!theme_dynamic_sidebar( $cat_slug ) AND !theme_dynamic_sidebar( $cat_parent_slug )) { theme_dynamic_sidebar('right'); } // Load sidebar file that matches category parent slug //theme_dynamic_sidebar('right'); // Load default sidebar file ?>
Forum: Fixing WordPress
In reply to: Sidebar to Modele category and childMy default category genere by archive.php is
commerce, sorties, habitat, loisirsI created in my thèmes sidebar-commerce.php , sidebar-sorties.php
sidebar-habitat.php sidebar-losirs.phpI insert the conditional in artchive.php
on its ligne for condition I add my default
get_sidebar(‘right’); // Load default sidebar fileNow how to make it work with categories that are not slug ?
Forum: Fixing WordPress
In reply to: Sidebar to Modele category and childIs that it is possible to do by default category Archive.php
I have a category that are not slug.thank you for your understanding
Forum: Fixing WordPress
In reply to: Sidebar to Modele category and childthank you so much for your answers