Hello,
I don’t want to display the post view count so I decided to hide it using CSS (I can’t disable them as per the note in 7 days post sorting):
.td-post-template-default .td-post-title {
display: none;
}
The problem is this trick is not working on my child theme’s style.css (the current active theme is the child theme you provided). The rules above are working on custom code/custom css section of the theme though.
Hi,
Well you do not have to use the child theme for custom css. Add the code in the theme panel-> custom css box
The code you added is not to hide the post views, but to hide the post title.
Please use this code to hide the post views:
.single .td-post-views{
display:none!important;
}
Thank you!
Hello Bogdan,
custom CSS code has to be inserted via child theme as described in official WordPress guide:
If your child theme style.css contains actual CSS code (as it normally does), you will need to enqueue it as well. Setting ‘parent-style’ as a dependency will ensure that the child theme stylesheet loads after it.
Please tell me how I need to modify the following script in order to personalise the theme CSS using child theme:
<?php
function my_theme_enqueue_styles() {
$parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
Yes, this is available for the default wordpress themes. Our theme already has this implemented in the theme panel under the custom code section so you do not have to use any child theme for any custom css. You can simply use the theme panel and all your css will apply with or without a child theme. If you do want to use a child theme and enque the css, then you should read this topic: https://wordpress.org/support/topic/theme-stanleywp-enqueuing-many-stylesheets-into-child-theme-in-correct-order/
Thank you!
Hello again,
so after customizing other parts of the theme I’ve noticed the title of all the posts were hidden. Inspecting, I’ve found the (wrong) rule causing the problem is the one I mentioned before:
.td-post-template-default .td-post-title{
display:none;}
After the inspection I checked the Custom CSS section of the Theme panel but the only (correct) rule there was the one you suggested me:
.single .td-post-views{
display:none!important;
}
Since the child-theme CSS is without any CSS rule, I don’t understand where this rule could be. Any idea?
As a temporary solution I’ve inserted the following rule in the Custom CSS section:
.td-post-template-default .td-post-title{
display:inherit!important;
}
Sorry for bothering you again.
Hi,
Not sure where that comes from, it can be from the theme itself as a custom modification. Did you modified the theme style.css file?
It can come from Theme Panel -> Custom Code or from a child theme.
If you can’t find it please provide the site url so we can take a look.
Thank you!