hello, i am trying to target and edit the look of a specific posts, shown in the front page,based on their tag. I have added the post_class or
<?php
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
in my child themes /css/index.php file. When i go to edit the desired post based on its tag, it does not work. my css code is
.tag-review .entry-title {
border:none;
}
can somebody help me solve this problem. In my child theme,I have a wp-content/theme folder/css/index.php, /images/index.php, and a /js/index.php. Which index.php does
the<?php
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
go in? The “.review” class is the tag of the posts im trying to target and “.entry-title” is what i am trying to change in the post. Can some one guide me in the right direction please?…Thank you.
Hello alchymyth, thanks so much for the reply. I am using headway themes and i am running a wamp set up so i cant provide a live link. In my child theme i have three index.php files in different locations.
wp-content/themes/custom code/css/index.php,
wp-content/themes/custom code/images/index.php, and
wp-content/themes/custom code/js/index.php
I inserted
<?php
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
inside all of them.
This is the html that was outputed
<div id="post-51" class="post-51 post type-post status-publish format-standard hentry category-pc tag-review author-test">
but the same html is there with or without the
<?php
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
inside the index.php files. I am starting to think that i need an index.php file in my main child theme folder
wp-content/themes/custom code/index.php.
but when i tried to put an empty index.php file their my front page goes blank.
but when i tried to put an empty index.php file their my front page goes blank.
make a copy of index.php of the parent theme wp-content/themes/parenttheme/index.php and add it into in your child theme wp-content/themes/custom-code/index.php, then edit it there.
I have copied the parents theme index.php file over to the child theme. ( wp-content/themes/custom-code/index.php ). The blank page problem is solved. The site shows properly now. i have added the post_class to the child themes index.php file like this.
<?php
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
?>
When i load the site i get a parse error.
” Parse error: syntax error, unexpected ‘<‘ in C:\wamp\www\wordpress-test\wp-content\themes\custom-code\index.php on line 19“.
in my text editor I checked line 19 and it is this.
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
i copied it straight out of the post_class wordpress page.
codex.wordpress.org/Function_Reference/post_class
the line from the Codex is all you need, no extra php tags;
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
alchymyth, i removed the <?php and the ?> opening and closing tags. Now the site works and no parse errors. Now when i go to target all the post with the tag “review“, every post including the ones with a different tag, receive the change.
the css i used.
.tag-review {
background-color:red;
}
without a live link to view the problem, nobody can help you with that.
try to get familiar with using a browser inspection tool to see where the formatting comes from.
as your theme does not seem to be from http://wordpress.org/themes/, it is not supported by this forum;
please contact the theme’s developer directly for support.