What am I doing wrong?
what are you trying to show?
is the output other than expected?
for starters, you are using the negation operator ! :
if ( ! is_single()) {
basically saying: if it is NOT a single post, do the first div,
else if it is NOT home, do the second div.
besides, ‘single_cat_title()’ is only defined in category archives.
Thread Starter
empfx
(@empfx)
Sorry, very new to wp and php and sadly the forums since I did not read the rules. – sincere apologies. I did my best to make sense of conditional tags but am clearly having troubles.
I am trying to show the post title on single pages and the category title on category pages across the top of the page. I don’t know why I said “all other pages” I was trying to make it simple I guess, hehe.
I did’nt know about the negation operator ! but my syntax must be horrible because it keeps throwing an unexpected end error at me.
the conditional tag for a category archive is is_category()
http://codex.ww.wp.xz.cn/Function_Reference/is_category
http://codex.ww.wp.xz.cn/Conditional_Tags
also, where do you want to link the category title to?
you might need to use:
<a href="<?php echo get_category_link(get_query_var('cat')); ?> "rel="bookmark" title="Permanent Link to <?php echo esc_attr( single_cat_title('', false) ); ?>"><?php single_cat_title(); ?></a>
and your code has syntax errors by mixing echo and php.
try:
http://pastebin.com/w3t4yFkN
Thread Starter
empfx
(@empfx)
Oh how this has boggled me to no end. Your amazing, thank you – works perfectly. I had another revision I was about to post and boy was I way off. I’ve struggled with this for days. Thanks for taking the time out to help me see the light, lol.