- This topic has 22 replies, 3 voices, and was last updated 5 years, 1 month ago by
Tom.
-
AuthorPosts
-
February 9, 2021 at 12:33 am #1651276
Johan
Hello David 🙂
The ideal for this site would be that “our-formations” as well as all the children categories are in columns (3 col if possible?):
– securite-incendie
– sante-et-prevention
– securite
– vtc
– hygiene
In addition, I would like to have for each card a button with the text “Discover this training”
Is it possible ?
Thank youFebruary 9, 2021 at 3:00 am #1651409David
StaffCustomer SupportSo you should be able to check if the category is an ancestor. So this line:
if ( is_category( 'nos-formations' ) ) {becomes:
if ( is_category( 'nos-formations' ) || cat_is_ancestor_of( 'nos-formations' ) ) {February 9, 2021 at 3:42 am #1651447Johan
This gives me an error, see here: https://dev1.directsolutions.fr/offres/nos-formations/securite/
or
https://dev1.directsolutions.fr/offres/nos-formations/securite-incendie/February 9, 2021 at 10:03 am #1652073Tom
Lead DeveloperLead DeveloperWhat’s the error? Can you check your
error_logfile for something specific?Let us know 🙂
February 10, 2021 at 2:29 am #1652762Johan
Hello,
Nothing is displayed in debug mode (wp-config = define (‘WP_DEBUG’, true);), the page is blank (ex. : https://dev1.directsolutions.fr/offres/nos-formations/securite-incendie/)…
Here is what Query monitor indicates: “Fatal error: Uncaught Error: Too few arguments for the cat_is_ancestor_of () function, 1 passed in /home/directl/dev1/wp-content/themes/generatepress_child/functions.php on the line 88 and exactly 2 expected
in /home/directl/dev1/wp-includes/category.php at line 246 “February 10, 2021 at 9:26 am #1653388Tom
Lead DeveloperLead DeveloperAh, try this:
$category = get_queried_object(); if ( is_category( 'nos-formations' ) || cat_is_ancestor_of( $category->term_id, 'nos-formations' ) ) {February 10, 2021 at 10:10 am #1653444Johan
Hello Tom and thank you 🙂
Indeed with this code I have no more errors however I have no columns either 🙁I put the current full code below for verification:
add_filter( ‘generate_blog_columns’,’tu_formation_columns’ );
function tu_formation_columns( $columns ) {
$category = get_queried_object();
if ( is_category( ‘nos-formations’ ) || cat_is_ancestor_of( $category->term_id, ‘nos-formations’ ) ) {
return true;
}
return $columns;
}February 11, 2021 at 9:16 am #1654740Tom
Lead DeveloperLead DeveloperIs this code doing anything on the
nos-formationscategory page? -
AuthorPosts
- You must be logged in to reply to this topic.