when i set a condition : disable for pages with “in categories xxx for example”. I can see all pages of this category at the location of the menu, so, big bug.
theme : illdy
wordpressVersion 5.6.2
plugin Conditional Menus : Version 1.1.9
Thanks for your help.
Regards.
]]>I’ve got a simple question. I’d like to remove the line “posted by x in category y” above every post. I’m using the Serene theme.
Could anyone help me?
Thanks in advance!
]]>Hi everybody!
I try to get this to work:
<?php if ( in_category( 5 ) ) { ?>
<br>
<?php wp_list_categories('child_of="5"&title_li=');?>
<br>
<?php wp_get_archives('type=monthly'); ?>
<br>
<?php wp_list_authors('show_fullname=1&optioncount=0&exclude_admin=0&orderby=post_count'); ?>
<?php } elseif ( in_category( 6 ) ) { ?>
<br>
<?php wp_list_categories('child_of=6&title_li=');?>
<?php } elseif ( in_category( 7 ) ) { ?>
<br>
<?php wp_list_categories('child_of=7&title_li=');?>
<?php } elseif ( in_category( 8 ) ) { ?>
<br>
<?php wp_list_categories('child_of=8&title_li=');?>
<?php } else { ?><br />
<?php } ?>
the weird thing is, that parts of the code work quite well. I can get
<?php wp_list_categories('child_of=6&title_li=');?>
to work out of the code, and the first if worked partially (showing me “no categories” and the archive and the authorlist before I decided to give category 5 some subcategories for my list_categories(‘child_of=”5″&title_li=’) to find.
After I gave cat 5 some subcategories, nothing gets shown anymore. Not even archive nor author.
what do do? I need the childs to be shown, and Archive and Author.
]]><?php if ( in_category( '18' )) {
include (TEMPLATEPATH . '/specialist-expertise-sidebar.php'); }
elseif ( in_category( '4' )) {
include (TEMPLATEPATH . '/industry-expertise-sidebar.php'); }
else {
if (in_category('4') && in_category('18')) {
include (TEMPLATEPATH . '/combined-expertise-sidebar.php'); }
}
?>
So to explain:
If the post is in category 18 then show specialist sidebar.
Or if the post is in category 4 then show the industry sidebar.
Or else if the post is in BOTH category 18 and 4 show the combined sidebar.
The else statement is where I’m struggling to target both of the categories…it just goes blank instead and none of it works.
Also I’m using in_category
but unsure of the correct use here, whether I should be using is_category
instead?
Can anyone advise and help to get this working? Thank you
<?php if (have_posts()) : while (have_posts()) : the_post() ; ?>
<?php if (in_category ('programs')) {
<h1 class="section">echo 'Classes'; </h1>
}
else {
<h1 class="section"> echo get_the_title( $post->post_parent ); </h1>
}
endif;
<a href="<?php the_permalink(); ?>"><h1 style="font-weight:bold"><?php the_title(); ?></h1> </a>
?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
]]>Thank you for this wonderful software!
I’m using the following code to grab the first image from the latest post
<?php echo get_first_image() ?>
which in turn calls this code
function get_first_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
// if no image displays show below image
if(empty($first_img)){ //Defines a default image
$first_img = "/images/default.jpg";
}
return $first_img;
}
I would like modify the code, so it grabs the first image from the latest post in a given Category.
I’ve tried for several hours but I’m not good enough with the coding, so I was hoping for some help from the forum. Thanks.
I purchase theme on themeforest, and now I wont change Related Posts, because show all last posts in single.php
This is code in single.php for Related Posts:
<?php getRelatedPosts(); ?>
I wont show only Related Posts by Category, not show all my posts from another category.
What I need change?
Thanx
In the above category structure I want the post navigation to work on all the posts in CATEGORY-A not just subcat1 or subca1-I…
According to the Codex
<?php previous_post_link($format, $link, $in_same_cat = true, $excluded_categories = ''); ?>
provides the navigation “previous post” in same category but how can i get the navigation in same ancestor category?
Please help
I will use in_category for category filter, but what about specified word. How to search post text if it has that word?
Has anyone any ideas?
]]>I’m not sure how to format this, any advice?
Thanks a lot
]]>