Hi, just wondering if someone could tell me how to do this please?
Also - how do I adjust the size of the font for the post meta?
(I’m using Pro)
Many thanks!
Hi, just wondering if someone could tell me how to do this please?
Also - how do I adjust the size of the font for the post meta?
(I’m using Pro)
Many thanks!
Hi there,
Please provide the link to your website so that we can provide you with the custom CSS.
No problem, it’s…
Hello There,
Thanks for providing the url of the site.
1.) To hide certain categories from the post meta, since the child theme is set up, please add the following code in your child theme’s functions.php file
// Entry Meta
// =============================================================================
if ( ! function_exists( 'x_ethos_entry_meta' ) ) :
function x_ethos_entry_meta() {
//
// Author.
//
$author = sprintf( ' %1$s %2$s</span>',
__( 'by', '__x__' ),
get_the_author()
);
//
// Date.
//
$date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
//
// Categories.
//
if ( get_post_type() == 'x-portfolio' ) {
if ( has_term( '', 'portfolio-category', NULL ) ) {
$categories = get_the_terms( get_the_ID(), 'portfolio-category' );
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
if ( $category != 'category-one' || $category != 'category-two') {
$categories_output .= '<a href="'
. get_term_link( $category->slug, 'portfolio-category' )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"> '
. $category->name
. '</a>'
. $separator;
}
}
$categories_list = sprintf( '<span>%1$s %2$s',
__( 'In', '__x__' ),
trim( $categories_output, $separator )
);
} else {
$categories_list = '';
}
} else {
$categories = get_the_category();
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
if ( $category != 'category-one' || $category != 'category-two') {
$categories_output .= '<a href="'
. get_category_link( $category->term_id )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"> '
. $category->name
. '</a>'
. $separator;
}
}
$categories_list = sprintf( '<span>%1$s %2$s',
__( 'In', '__x__' ),
trim( $categories_output, $separator )
);
}
//
// Comments link.
//
if ( comments_open() ) {
$title = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
$link = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
$number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
$text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
$comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
esc_url( $link ),
esc_attr( sprintf( __( 'Leave a comment on: “%s”', '__x__' ), $title ) ),
$text
);
} else {
$comments = '';
}
//
// Output.
//
if ( x_does_not_need_entry_meta() ) {
return;
} else {
printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
$categories_list,
$author,
$date,
$comments
);
}
}
endif;
// =============================================================================
Simply find this line if ( $category != 'category-one' || $category != 'category-two') {
and replace the category-one
or category-two
to your desired category that you want to hide from the post meta.
2.) To adjust the size of the font for the post meta, please add the following CSS code in the X > Launch > Theme Options > Global CSS (http://prntscr.com/evui3r)
body .p-meta {
font-size: 14px;
}
We would loved to know if this has work for you. Thank you.
Hey thanks!
Unfortunately this didn’t work. It returned a blank screen once the code was put into the functions.php file on the child theme. I did notice there were two instances of that line appearing in the code, so I replaced both, but it just gave me the blank screen.
Worked perfectly, thank you!
There was also another issue that occurred overnight…
Hello There,
Thanks for updating in!
1.) You must have pasted the wrong code. Could you please insert your code in the next reply?
2.) The single product image is way smaller. Please adjust it set the image size to at least 1024. For further information about WooCommerce image size, please check out this: https://docs.woocommerce.com/document/fixing-blurry-product-images/
Hope this helps.
I tried the provided code in the child theme’s functions.php file. I need to hide 15 portfolio categories used by Essential grid to display portfolio item.
Here is an example of portfolio item with thematique-vivre-2 and accueil-vivre that I do not want to display.
https://lekamouraska.com/offres/17-municipalites-en-operation-seduction/
Here is my code:
// Entry Meta
// =============================================================================
if ( ! function_exists( 'x_ethos_entry_meta' ) ) :
function x_ethos_entry_meta() {
//
// Author.
//
$author = sprintf( ' %1$s %2$s</span>',
__( 'by', '__x__' ),
get_the_author()
);
//
// Date.
//
$date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
//
// Categories.
//
if ( get_post_type() == 'x-portfolio' ) {
if ( has_term( '', 'portfolio-category', NULL ) ) {
$categories = get_the_terms( get_the_ID(), 'portfolio-category' );
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
if ( $category != 'accueil-visiter' || $category != 'accueil-vivre' || $category != 'accueil-travailler' || $category != 'accueil-etudier' || $category != 'accueil-entreprendre' || $category != 'thematique-visiter-1' || $category != 'thematique-visiter-2' || $category != 'thematique-vivre-1' || $category != 'thematique-vivre-2' || $category != 'thematique-travailler-1' || $category != 'thematique-travailler-2' || $category != 'thematique-etudier-1' || $category != 'thematique-etudier-2' || $category != 'thematique-entreprendre-1' || $category != 'thematique-entreprendre-1') {
$categories_output .= '<a href="'
. get_term_link( $category->slug, 'portfolio-category' )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"> '
. $category->name
. '</a>'
. $separator;
}
}
$categories_list = sprintf( '<span>%1$s %2$s',
__( 'In', '__x__' ),
trim( $categories_output, $separator )
);
} else {
$categories_list = '';
}
} else {
$categories = get_the_category();
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
if ( $category != 'accueil-visiter' || $category != 'accueil-vivre' || $category != 'accueil-travailler' || $category != 'accueil-etudier' || $category != 'accueil-entreprendre' || $category != 'thematique-visiter-1' || $category != 'thematique-visiter-2' || $category != 'thematique-vivre-1' || $category != 'thematique-vivre-2' || $category != 'thematique-travailler-1' || $category != 'thematique-travailler-2' || $category != 'thematique-etudier-1' || $category != 'thematique-etudier-2' || $category != 'thematique-entreprendre-1' || $category != 'thematique-entreprendre-1') {
$categories_output .= '<a href="'
. get_category_link( $category->term_id )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"> '
. $category->name
. '</a>'
. $separator;
}
}
$categories_list = sprintf( '<span>%1$s %2$s',
__( 'In', '__x__' ),
trim( $categories_output, $separator )
);
}
//
// Comments link.
//
if ( comments_open() ) {
$title = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
$link = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
$number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
$text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
$comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
esc_url( $link ),
esc_attr( sprintf( __( 'Leave a comment on: “%s”', '__x__' ), $title ) ),
$text
);
} else {
$comments = '';
}
//
// Output.
//
if ( x_does_not_need_entry_meta() ) {
return;
} else {
printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
$categories_list,
$author,
$date,
$comments
);
}
}
endif;
// =============================================================================
Hello There,
Thank you for updating this thread. You must understand that the code above is used for someone’s site which is using Ethos stack. On the other hand, in your site, you are using Integrity stack. You should make use of this code instead to get rid of the categories:
// Entry Meta
// =============================================================================
if ( ! function_exists( 'x_integrity_entry_meta' ) ) :
function x_integrity_entry_meta() {
//
// Author.
//
$author = sprintf( '<span><i class="x-icon-pencil" data-x-icon=""></i> %s</span>',
get_the_author()
);
//
// Date.
//
$date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon=""></i> %2$s</time></span>',
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
//
// Categories.
//
if ( get_post_type() == 'x-portfolio' ) {
if ( has_term( '', 'portfolio-category', NULL ) ) {
$categories = get_the_terms( get_the_ID(), 'portfolio-category' );
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
$categories_output .= '<a href="'
. get_term_link( $category->slug, 'portfolio-category' )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"><i class="x-icon-bookmark" data-x-icon=""></i> '
. $category->name
. '</a>'
. $separator;
}
$categories_list = sprintf( '<span>%s</span>',
trim( $categories_output, $separator )
);
} else {
$categories_list = '';
}
} else {
$categories = get_the_category();
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
$categories_output .= '<a href="'
. get_category_link( $category->term_id )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"><i class="x-icon-bookmark" data-x-icon=""></i> '
. $category->name
. '</a>'
. $separator;
}
$categories_list = sprintf( '<span>%s</span>',
trim( $categories_output, $separator )
);
}
//
// Comments link.
//
if ( comments_open() ) {
$title = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
$link = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
$number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
$text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
$comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments" data-x-icon=""></i> %3$s</a></span>',
esc_url( $link ),
esc_attr( sprintf( __( 'Leave a comment on: “%s”', '__x__' ), $title ) ),
$text
);
} else {
$comments = '';
}
//
// Output.
//
if ( x_does_not_need_entry_meta() ) {
return;
} else {
printf( '<p class="p-meta">%1$s%2$s%3$s</p>',
$author,
$date,
$comments
);
}
}
endif;
// =============================================================================
We would loved to know if this has work for you. Thank you.
Sorry for my ignorance but there is no «if ( $category != ‘category-one’ || $category != ‘category-two’)» in that code. What do I have to change to hide these categories?
if ( $category != 'accueil-visiter' || $category != 'accueil-vivre' || $category != 'accueil-travailler' || $category != 'accueil-etudier' || $category != 'accueil-entreprendre' || $category != 'thematique-visiter-1' || $category != 'thematique-visiter-2' || $category != 'thematique-vivre-1' || $category != 'thematique-vivre-2' || $category != 'thematique-travailler-1' || $category != 'thematique-travailler-2' || $category != 'thematique-etudier-1' || $category != 'thematique-etudier-2' || $category != 'thematique-entreprendre-1' || $category != 'thematique-entreprendre-1') {
The code you provide hide all categories and this is not what I need. I need to choose what I hide.
Hi There,
Add the if statement on the same part of the code. Look for this part:
foreach ( $categories as $category ) {
$categories_output .= '<a href="'
. get_term_link( $category->slug, 'portfolio-category' )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"><i class="x-icon-bookmark" data-x-icon=""></i> '
. $category->name
. '</a>'
. $separator;
}
That’s the loop, the part where we iterate the categories. We need to add it on that part like this:
foreach ( $categories as $category ) {
if ( $category != 'category-one' || $category != 'category-two') {
$categories_output .= '<a href="'
. get_term_link( $category->slug, 'portfolio-category' )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"><i class="x-icon-bookmark" data-x-icon=""></i> '
. $category->name
. '</a>'
. $separator;
}
}
The if statement filters the category that will show. If the category is not part of the if condition it will display.
Hope this helps.
This is not working. This portfolio item https://lekamouraska.com/offres/17-municipalites-en-operation-seduction/ have 3 categories.
Number 3 «vivre» does not display.
Here is my code:
// Entry Meta
// =============================================================================
if ( ! function_exists( 'x_integrity_entry_meta' ) ) :
function x_integrity_entry_meta() {
//
// Author.
//
$author = sprintf( '<span><i class="x-icon-pencil" data-x-icon=""></i> %s</span>',
get_the_author()
);
//
// Date.
//
$date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon=""></i> %2$s</time></span>',
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
//
// Categories.
//
if ( get_post_type() == 'x-portfolio' ) {
if ( has_term( '', 'portfolio-category', NULL ) ) {
$categories = get_the_terms( get_the_ID(), 'portfolio-category' );
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
if ( $category != 'accueil-vivre' || $category != 'thematique-vivre-1' || $category != 'thematique-vivre-2') {
$categories_output .= '<a href="'
. get_term_link( $category->slug, 'portfolio-category' )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"><i class="x-icon-bookmark" data-x-icon=""></i> '
. $category->name
. '</a>'
. $separator;
}
}
$categories_list = sprintf( '<span>%s</span>',
trim( $categories_output, $separator )
);
} else {
$categories_list = '';
}
} else {
$categories = get_the_category();
$separator = ', ';
$categories_output = '';
foreach ( $categories as $category ) {
if ( $category != 'accueil-vivre' || $category != 'thematique-vivre-1' || $category != 'thematique-vivre-2') {
$categories_output .= '<a href="'
. get_term_link( $category->slug, 'portfolio-category' )
. '" title="'
. esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) )
. '"><i class="x-icon-bookmark" data-x-icon=""></i> '
. $category->name
. '</a>'
. $separator;
}
}
$categories_list = sprintf( '<span>%s</span>',
trim( $categories_output, $separator )
);
}
//
// Comments link.
//
if ( comments_open() ) {
$title = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
$link = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
$number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
$text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
$comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments" data-x-icon=""></i> %3$s</a></span>',
esc_url( $link ),
esc_attr( sprintf( __( 'Leave a comment on: “%s”', '__x__' ), $title ) ),
$text
);
} else {
$comments = '';
}
//
// Output.
//
if ( x_does_not_need_entry_meta() ) {
return;
} else {
printf( '<p class="p-meta">%1$s%2$s%3$s</p>',
$author,
$date,
$comments
);
}
}
endif;
// =============================================================================
Hi there,
Please kindly consider that this is a customization request and outside of our support scope. We can only suggest the codes that we think it will work but the actual customization should be done by you.
If you have problems you will need to hire a developer to help you around. Regarding the suggested code, it is completely correct and you need to check if that even the default code shows the categories or not for you.
Thank you for your understanding.
It should be easy to do. That is why we buy Pro or X.
Please kindly consider that this is not the support we expect from Themeco.
Thank you for your understanding.
Hi,
This is something we can add to our list of feature requests. This way it can be taken into consideration for future development.
Thanks!