Include category title in wp_title

Create a helper function to get all parent categories (each post can be in multiple categories): function parent_cat_names( $sep = ‘|’ ) { if ( ! is_single() or array() === $categories = get_the_category() ) return ”; $parents = array (); foreach ( $categories as $category ) { $parent = end( get_ancestors( $category->term_id, ‘category’ ) ); … Read more

Display all posts with same title

Lets use the build in features WordPress has to offer. It is almost always not adviced to use custom SQL whenever WordPress offers native functions to perform the specific duty. To query our posts, we will make use of WP_Query. The only problem is, WP_Query does not support the feature where we look for posts … Read more

Can’t change the title tag with wp_title filter

When adding title-tag support in a theme, the title tag can be filtered by several filters, but not wp_title. The reason is that if the theme supports title-tag, WordPress uses wp_get_document_title() instead of wp_title(). For themes with support for title-tag you can use document_title_parts: add_filter( ‘document_title_parts’, ‘filter_document_title_parts’ ); function filter_document_title_parts( $title_parts ) { $title_parts[‘title’] = … Read more

Blank on static home page?

From the Codex If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title. Here goes a neat hack to add the description/tagline at the wp_title place on homepage: add_filter( ‘wp_title’, ‘baw_hack_wp_title_for_home’ ); function baw_hack_wp_title_for_home( $title ) { if( empty( $title ) && ( … Read more

Change Default Custom Fields Metabox Name

You need to declare the $wp_meta_boxes array as global: global $wp_meta_boxes; If it still doesn’t work try: add_filter(‘add_meta_boxes’, ‘change_meta_box_titles’); function change_meta_box_titles() { global $wp_meta_boxes; echo ‘<pre>’; print_r($wp_meta_boxes); echo ‘</pre>’; } to see what’s going on (and to check where the title is). You should also prefix your function names to prevent a clash with WP … Read more

Remove “Category Archives: title” at the top of a category page [duplicate]

The text is coming from Twenty Eleven theme’s category.php file. There are two ways to remove it: A) Removing it using a Text/CODE Editor on the File System/FTP: This is the recommended method Go to Your WordPress Installation Folder. Then wp-content/themes/twentyeleven folder. Then open the category.php file in a Text or CODE Editor. On line … Read more

Change post title during post saving process

You can hook into wp_insert_post_data and change things. <?php add_filter(‘wp_insert_post_data’, ‘wpse67262_change_title’); function wpse67262_change_title($data) { $data[‘post_title’] = ‘This will change the title’; return $data; } Obviously you’re going to have to some checks and stuff so you don’t change every post title. That hook will also fire every time the post is saved (adding a new … Read more

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