Dont’t change active Button while I’m listing a category?

Okay, I did it this way:: add_filter(‘nav_menu_css_class’ , ‘special_nav_class’ , 10 , 2); function special_nav_class($classes, $item){ if(is_category() && $item->title == “Blog”){ //Notice you can change the conditional from is_single() and $item->title $classes[] = “special-class”; } return $classes; }

Customize the WordPress Default Gallery Output

Like always is WordPress, there is a filter to do this, without the need of a regular expression, that might fail if anything changes. Here is the code for the output: <?php add_filter(‘wp_get_attachment_image_attributes’, function($attr, $attachment){ unset($attr[‘alt’]); // Just deleting the alt attr return $attr; }, 10, 2); $url = wp_get_attachment_url( $attachment->ID ); $name = esc_attr( … Read more

How to remove comment link title attribute?

The title attribute is hard-coded in comments_popup_link() unfortunately: echo ‘ title=”‘ . esc_attr( sprintf( __(‘Comment on %s’), $title ) ) . ‘”>’; What you can do is catching the generated HTML in a variable and replacing the attribute with an empty string: ob_start(); comments_popup_link(); print preg_replace( ‘~ title=”[^”]+”~’, ”, ob_get_clean() );

Admin only menu/page

Yes, it is possible. You could use wp_nav_menu_objects or wp_nav_menu_items hooks to add your filter function. function my_hide_menu_items($objects) { if ( is_admin() ) return $objects; foreach ( $objects as $k=>$object ) { if ( YOUR CONDITION ) { // if $object shouldn’t be displayed unset($objects[$k]); } } return $objects; } add_filter(‘wp_nav_menu_objects’, ‘my_hide_menu_items’, 10, 2); You … Read more

Delete link on single-custom.php with redirection

Rather than “still on” page the user actually goes to the link and then sent back after post is deleted. From your description and quick look at code this is probably line that sends user back: wp_redirect( add_query_arg(‘deleted’, 1, $sendback) ); Since destination is filtered inside wp_redirect() $location = apply_filters( ‘wp_redirect’, $location, $status ); and … Read more

Make page tab link to pdf

If you are talking about menus and your theme uses the Menu API, then upload the PDF to a publicly accessible server– doesn’t have to to be the one your site uses– then go to Appearance -> Menus, Navigate to a menu, or create one find the “Links” dialogue, input the URL and the link … Read more

Relative links for performance?

It’s a valid theory and under some circumstances such micro-optimization might make a difference (making content fit into single packet rather than be split into two). However you misinterpret the size information. 8.5KB is gzip-compressed version of your page. Since repeats of same string are highly compressible, your optimization won’t reduce this by 5KB. How … Read more

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