NextGEN Conditional Statement [closed]

I figured it out!! My final code looks like: <?php $images = intval($wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->nggpictures”)); $ngg_options = nggGallery::get_option(“ngg_options”); $maxElement = $ngg_options[“galImages”]; if ($images > $maxElement) { echo “duck”; } ?> Basically the code checks see if the number of images IS larger than the number of images displayed per page…if it is larger I … Read more

Add class to DIV depending on page loaded

You might want to consider using the WordPress function body_class() <body <?php body_class($class); ?>> Then you could use the body class as your current page reference. This function is for example used by the Twenty-Twelve theme. For a single post it will become <body class=”single single-post …”> and for the home page: <body class=”home blog … Read more

How to write this conditional statement?

is_tag checks whether the page being displayed is the tag archive page for the named tag. It does not check whether the post in a Loop has that tag, which is what you ask: “…to show if the post has tag premium…”. For that you need has_tag if has_tag( ‘premium’ ){ ?> <a href=”https://wordpress.stackexchange.com/questions/125158/<?php the_permalink(); … Read more

Check if sidebar is rendered?

If your certain sidebar widget area is page-specific then I think you need to load classes only to those pages. If so, use is_page() with it: if( is_page(‘that-page’) && is_active_sidebar(‘your-sidebar’) ) { $class=”your-class “; } If it’s true for all the inner pages other than the front-page, use: if( !is_front_page() && is_active_sidebar(‘your-sidebar’) ) { $class=”your-class … Read more

FacetWP – conditionally display facet labels

Your code seems identical to FacetWP’s. The only variable I can think of is code placement. You might not be placing the code where it belongs (functions.php or a plugin). A quick fix would be adding their code to your theme’s functions.php: function fwp_add_facet_labels() { ?> <script> (function($) { $(document).on(‘facetwp-loaded’, function() { $(‘.facetwp-facet’).each(function() { var … Read more

Conditional: IF current user has NOT commented on current post (not including post author)

[EDIT] Here is the modified code: $post_id = get_the_ID(); // ID of the current post. $user_id = get_current_user_id(); // ID of the current user. $post_author_id = get_post_field( ‘post_author’, $post_id ); $is_post_author = ( $user_id && $post_author_id == $user_id ); $can_comment = $is_post_author; /* * If $can_comment is not yet TRUE, then it’s because either: * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)