How to set custom title of custom page template?

Reference Got success by adding this code to your-page-template.php file before get_header() function: function my_page_title() { return ‘Your value is ‘; // add dynamic content to this title (if needed) } add_action( ‘pre_get_document_title’, ‘my_page_title’ );

How to make a H1 different then the Title?

Yes! Custom fields: http://codex.wordpress.org/Custom_Fields You can create alternate post titles via the post editor, and then you can display them with some minor adjustments to the single.php and index.php templates (or {$post_type}-archive.php templates, if you have them). For example: <?php $post_title = get_post_meta($post->ID, ‘Post-Title’, true); //”Post-Title” or whatever you call your custom field if ($post_title) … Read more

WordPress i18n-friendly preg_replace post title

We can use the protected_title_format and private_title_format filters, available since WordPress version 2.8: add_filter( ‘protected_title_format’, ‘wpse_pure_title’, 10, 2 ); add_filter( ‘private_title_format’, ‘wpse_pure_title’, 10, 2 ); function wpse_pure_title( $format, \WP_Post $post ) { return ‘mycpt’ === get_post_type( $post ) ? ‘%s’ : $format; } to get rid of the “Private:” and “Protected:” parts on the front-end … Read more

How to get page’s ID if I know the title only?

I’m not sure how to get it via the title, but you can get it via the slug (which is often more useful in my experience) using this: http://erikt.tumblr.com/post/278953342/get-a-wordpress-page-id-with-the-slug Just change “$page” to “$post” if you want to return slugs for posts instead of pages. G’luck!

Changing “Enter title here” based on post format

You need to do the following; jQuery(document).ready(function( $ ) { $(‘input.post-format’).click(function(){ $(‘#title-prompt-text’).val( $(this).next(‘label’).text()); }) }); This will replace the title with whichever post format you select. Save the above into a file called custom-post-title.js and you will need to place this file into your theme folder. Either in the root or within a folder named … Read more

REQUIRED: The theme must not used the tags. | REQUIRED: The theme must not call to wp_title()

WordPress added support for the title-tag feature in version 4.1 and it’s now a required feature for themes uploaded to the repo. To implement this feature, make sure your theme does not have the title tag hard coded within header.php, e.g.: <title><?php wp_title( ‘|’, true, ‘right’ ); ?></title> Configure your theme with title-tag support like … Read more

Empty title on front page/Home

The title is empty at the front page in WordPress. Yes, that sucks. Just put the separator into wp_title(): <title><?php // separator, print immediately, separator position wp_title( ‘·’, TRUE, ‘right’ ); bloginfo( ‘name’ ); ?></title> This prints out just the blog name on the front page and PAGE NAME · BLOG NAME on other pages.

Fill post titles from post content?

Hook into the_post – called when the post is actually used – and fill the title. Be aware the slug has to be changed too. If you are used not to enter a title, hook into save_post too, and let the same code do this for you. The code Download on GitHub <?php /** * … Read more

Modify page title format (when using title-tag)

If you’re using the Yoast SEO plugin (which it looks like you are) then this answer might help you If you are using yoast SEO plugin then the easiest method is to remove the archive word from “titles & metas-> Taxonomies->category” find: %%term_title%% Archives %%page%% %%sep%% %%sitename%% replace it with: %%term_title%% %%page%% %%sep%% %%sitename%% Alternatively … Read more

the_title filter applying to menu items

Use in_the_loop() conditional tag to make sure you are modifying the title inside the Loop and to prevent the hook changing titles somewhere else: function customize_wishlist_title( $title ){ $current_user = wp_get_current_user(); $loggeduser = $current_user->user_login; // give attention to the following condition: if ( is_page( 258 ) && in_the_loop() ) { $title=”<span class=”username”>”.$loggeduser.’\’s’.'</span>’.’&nbsp;’.'<span>Wishlist</span>’; } return $title; … Read more

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