I want to edit it for just this template only. not globally.
Look at the <body> tag for pages produced by that template and you’ll see that it has a template-specific class added. So you’d do something like
.template_class h2.entry-title { font-family: somefont; }
in your CSS.
oh im using mini bootstrap for css and JS I entered what you put down in add custom css for that specific page. nothing happened.
heres the file calling that template
page-home.php
<! DOCTYPE html>
<?php get_header(); ?>
<div class="row">
<?php
$args_cat = array(
'include' => '8,10,9,13'
);
$categories = get_categories($args_cat);
foreach($categories as $category):
$args = array(
'type' => 'post',
'posts_per_page' => 1,
'category__in' => $category->term_id,
'category__not_in' => array( 4 ),
);
$lastBlog = new WP_Query( $args );
if( $lastBlog->have_posts() ):
while( $lastBlog->have_posts() ): $lastBlog->the_post(); ?>
<div class="col-xs-12 col-sm-4">
<?php get_template_part('content','featured'); ?>
</div>
<?php endwhile;
endif;
wp_reset_postdata();
endforeach;
?>
</div>
<div class="row">
<div class="col-xs-12 col-sm-8">
<?php
if( have_posts() ):
while( have_posts() ): the_post(); ?>
<?php get_template_part('content',get_post_format()); ?>
<?php endwhile;
endif;
//PRINT OTHER 2 POSTS NOT THE FIRST ONE
/*
$args = array(
'type' => 'post',
'posts_per_page' => 2,
'offset' => 1,
);
$lastBlog = new WP_Query($args);
if( $lastBlog->have_posts() ):
while( $lastBlog->have_posts() ): $lastBlog->the_post(); ?>
<?php get_template_part('content',get_post_format()); ?>
<?php endwhile;
endif;
wp_reset_postdata();
*/
?>
<!-- <hr> -->
<?php
//PRINT ONLY TUTORIALS
/*
$lastBlog = new WP_Query('type=post&posts_per_page=-1&category_name=midday-atrocity');
if( $lastBlog->have_posts() ):
while( $lastBlog->have_posts() ): $lastBlog->the_post(); ?>
<?php get_template_part('content',get_post_format()); ?>
<?php endwhile;
endif;
wp_reset_postdata();
*/
?>
</div>
<div class="col-xs-12 col-sm-4">
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
</html>
yeah the code doesn’t work in custom css.
also the only thing I can see for body viewing page source is
* html body { margin-top: 46px !important; }
}
</style>
<style type="text/css" id="wp-custom-css">
/*
You can add your own CSS here.
Click the help icon above to learn more.
*/
</style>
<!-- Dojo Digital Hide Title -->
<script type="text/javascript">
jQuery(document).ready(function($){
if( $('.entry-title').length != 0 ) {
$('.entry-title span.dojodigital_toggle_title').parents('.entry-title:first').hide();
} else {
$('h1 span.dojodigital_toggle_title').parents('h1:first').hide();
$('h2 span.dojodigital_toggle_title').parents('h2:first').hide();
}
});
</script>
<noscript><style type="text/css"> .entry-title { display:none !important; }</style></noscript>
<!-- END Dojo Digital Hide Title -->
</head>
<body class="home page-template-default page page-id-2 logged-in admin-bar no-customize-support custom-background wp-custom-logo crazyjerks-class my_class">
something is messed up here lmao. I do like the idea of changing fonts for h2 tags tho
what about arguments in this function? that possible?
<?php the_category(); ?>
ok I was able to change the fonts for Post entry title in the arguments by simply
adding
<?php the_title( sprintf('<font face="impact"><h2 class="entry-title"><a href="%s">', esc_url( get_permalink() ) ),'</a></h2></font>' ); ?>
however it didn’t work one bit for cat entry titles haha
ok I was able to get it by simply adding the font face html code around the get_category function like
<font face="impact"><?php the_category(); ?></font>
is that a good way of doing it steve? anything wrong with that way?
That’s absolutely the wrong way to do it. Do not set that stuff in PHP. It belongs in CSS. Please re-read my first response and look at the body tag (view page source) on a page produced by that template.
<body class="home page-template-default page page-id-2 logged-in admin-bar no-customize-support custom-background wp-custom-logo Juicyjuice-class my_class">
here it is.
for some reason I cant comprehend what you said.
how do I apply this to
this?
.template_class h2.entry-title { font-family: somefont; }
I get I can replace somefont to whatever font. ami suppose to replace .template_class with ??
The template class for that page is
.page-template-default, and the specific page class is .page-id-2.
so
.page-id-2 h2.entry-title { font-family: somefont; }
I should try that before I asked. that was my next step. its the simplest things I find myself having the most trouble with. too focused on complicated things bypassing basics.
thanks steve. hey not for nothing. you seem to be the only one that responds to my posts around here. People don’t want to deal with noobs or what?
one more thing. how can I make that global to effect all pages?
oh yeah and that didn’t work. lol just tried it.
this is what I mean. about ot rip my hair out of my head
Trying everything here for what you said. Still isn’t working. Not quite sure how to go about this. Any more info you might need ?
My other option here is to just edit h2 tags in custom CSS. I’m guess I’ll just have to stick to that route until I can figure out what the hell is happening . Lol
But that only works for Posts displayed. Not the title of the category. If I switch the sprintf to the_category instead of the_title that won’t help either
-
This reply was modified 9 years, 2 months ago by
juicyjuke.