Weird html output of single_cat_title – is not inside of the html element?
By default single_cat_title(), a wrapper for single_term_title(), outputs the category name. Try replacing that call with single_cat_title(”,false).
By default single_cat_title(), a wrapper for single_term_title(), outputs the category name. Try replacing that call with single_cat_title(”,false).
(Expanding on Pieter’s comment above, and explaining the logic behind it…) if() evaluates the conditions in the parentheses, and that evaluation results in either TRUE or FALSE for the sum total (which can change, depending on how the various conditions are combined). In plain English, if( !is_singular(‘device’) || !is_front_page() ) means, “If it’s either true … Read more
This is not really a WordPress Question, as you made a basic PHP mistake, but I’ll help you anyway 😉 you forgot to close the conditional with an } before the elseif statements. This should work: <ul> <?php if (get_post_meta($post->ID, ‘hm_check_image1’, true)) { ?> <li> stufff stuff other meta info… </li> <?php } else if … Read more
$comment = get_comment( $CommentID ); $commentatorID = $comment->user_id; if ($commentatorID > 0 ) { //Comment made by registered user, do stuff } From the codex get_comment(), about the return value of user_id: user_id (integer) The comment author’s ID if he is registered (0 otherwise)
Add a function to your functions.php file like this: function slider_scripts() { wp_enqueue_style( ‘slider-java-script’, get_template_directory_uri() . ‘/css/slider-java-script.css’ ); //change the location to work for you } Then add slider_scripts() to the top of the template part ( partials/slider/slider-java-script.php )
Take a look at the classes offered by your body_class() function to your <body> element. Then overwrite your div with the ID #main on your posts page with a higher specifity and set this div to display: none;.
So, you can use: <?php if( !is_page(’37’) ):?> SHOW STUFF <?php endif;?> P.S. ! (not parameter) Good tutorial – http://sixrevisions.com/web-development/php-conditional-statements/
If you’re testing against two falses you have to use the logical AND operator, because BOTH have the be false. <?php if( !is_home() && !is_archive()) { ?> (some content) <?php ?>
Returns true or false friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() )
There is no while/else in PHP that I know of. Second, I find “alternate” control structure syntax impossible to read, especially with two or three on the same line. Use brackets and properly indent your code. It will make a lot more sense. <?php $tags = wp_get_post_tags($post->ID); if ($tags) { ?> <h3>Related</h3> <?php $first_tag = … Read more