Generating images from an array of categories

is_category() takes an array as arguments if you want to check for more than one category. But you can make it even easier with a check for existing files: if ( is_category() ) { $slug = get_queried_object()->slug; $theme_path = “/images/slider_$slug.png”; $file = get_template_directory() . $theme_path; if ( file_exists( $file ) ) { echo ‘<img src=”‘ … Read more

Show image next to the comment author if have certain role

Conditional tags are used to change content on the basis of what conditions a page meets. While there are no conditional tags depending on a user’s role, this is how you can manipulate content depending on roles: Display content to the user, depending on his role <?php global $current_user; get_currentuserinfo(); //not strictly required, $current_user should … Read more

is_front_page breaks with url parameters generated by a plugin

I’m not sure if lang is a reserved/used query variable in WordPress, but if it’s not, then adding might help. Use a filter on query_vars like this: function my_query_vars( $vars ) { $vars[] = ‘lang’; return $vars; } add_filter( ‘query_vars’, ‘my_query_vars’ ); Although WordPress will now know about the language query variable, I’m not sure … Read more

Why is the `if else` not working?

Assuming you’re using the function is_category_or_sub() as given on http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/ That function takes category id as the argument, not the slug. The string “gamenews” here when type-casted to an integer becomes 0 which is an ancestor for every other category. Can you try changing the function code to this- // If is category or subcategory … Read more

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