admin管理员组文章数量:1384246
I have a basic loop within single.php Also the class .title_name within style.css hooked up with functions.php i.e all is set and working. My code snippet below:
<?php
while(have_posts()) {
the_post();
?>
<!-- HTML STARTS HERE -->
<h2 <?php echo $titleTemplate; ?> ><?php the_title(); ?></h2>
<!-- HTML ENDS UP HERE -->
<p><?php the_content(); ?></p>
<?php } ?>
<?php
if (is_single()) : return $titleTemplate = 'class="title_name"';
endif; ?>
As far as I am considered I have to write simple IF statement which checks if I am within any post, if true It should return a variable with some class assigned to. After I just do echo within desirable opening tag elment but no result at all. Maybe it's scope issue. I am not very familiar with wordpress coding nor php itself yet so any help would be appreciated.
本文标签: phpHow do I add a predefined class to a custom html element
版权声明:本文标题:php - How do I add a predefined class to a custom html element? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744496182a2609040.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论