I am trying to add to my header a statement that if it's a single page it will insert my div content and if it is all other pages it will enter a different div content. This is my code.
[Code moderated as per the Forum Rules. Please use the pastebin]
What am I doing wrong?
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.
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.
oops, here is the code.
code
the conditional tag for a category archive is is_category()
http://codex.wordpress.org/Function_Reference/is_category
http://codex.wordpress.org/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
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.