Dynamic webpage titles
Dynamic webpage titles
Dynamic webpage titles
You could do an outside query instead. <?php define(‘WP_USE_THEMES’, false); global $wpdb; require(ROOT_DIR.’/blog/wp-load.php’); query_posts(‘showposts=1’); get_header(); try{ $args = array(‘post_type’ => array(‘post’), ‘posts_per_page’ => -1); $qry = null; $qry = new WP_Query($args); if($qry->have_posts()){ while($qry->have_posts()){ $qry->the_post(); $theTitle = get_the_title(); print $theTitle.'<br>’; } wp_reset_query(); }else{ print ‘no records found’; } }catch(Exception $e){ print $e->getMessage(); } get_footer(); ?>
YOAST’s SEO Title is stored within a meta_key. Try this- $taxonomy = get_queried_object()->taxonomy; $term_id = get_queried_object()->term_id; $meta = get_option( ‘wpseo_taxonomy_meta’ ); $title = $meta[$taxonomy][$term_id][‘wpseo_title’]; Or this- $titles = get_option( ‘wpseo_titles’ );
I try this following code with Events Made Easy version 2.0.35. It looks like you were near of the solution. you have found all bricks but you don’t have succeed to assemble them. Try this code to deactivate the automatic title if this is a event page and if the config of the title is … Read more
Try this: add_action( ‘wp’, ‘storefront_remove_title_from_home_homepage_template’ ); function storefront_remove_title_from_home_homepage_template() { remove_action( ‘storefront_homepage’, ‘storefront_homepage_header’, 10 ); } or if you use default template add_action( ‘wp’, ‘_storefront_remove_title_from_home_default_template’ ); function storefront_remove_title_from_home_default_template() { if ( is_front_page() ) remove_action( ‘storefront_page’, ‘storefront_page_header’, 10 ); }
Those look like smart apostrophes to me. They have a curve on theme. Try: <title><?php wp_title(‘ | ‘, ‘echo’, ‘right’); ?> – <?php bloginfo(‘name’); ?></title> Otherwise post what you have around that php section too.
to show the page title for the page set as the ‘blog’ or ‘posts page’, you need to add some code, maybe via a filter on wp_title(); example: add_filter( ‘wp_title’, ‘wpse_174379_show_posts_page_wp_title’ ); function wpse_174379_show_posts_page_wp_title( $title ) { if( get_option( ‘page_for_posts’ ) ) { $posts_page = get_post( get_option( ‘page_for_posts’) ); $title=” ” . $posts_page->post_title . ‘ … Read more
This is most likely due to difference in your theme’s support. Some themes render the title by using the wp_title filter, some by using pre_get_document_title. If your theme has this line in its functions.php file: add_theme_support(‘title-tag’); Then you need to use the pre_get_document_title filter, as follows: add_filter(‘pre_get_document_title’, ‘my_title’); function my_title() { return ‘Some title’; } … Read more
Do you have any SEO plugins installed? They usually fiddle with this logic. Having Yoast enabled, the pre_get_document_title does not work for me, instead you should use wpseo_title per their documentation. Having said that, with SEO plugins disabled and add_theme_support(‘title-tag’); enabled, the pre_get_document_title filter works for me without any problem. add_action(‘after_setup_theme’, function () { add_theme_support(‘title-tag’); … Read more
Try this to create your custom titles. remove_filter( ‘wp_title’, ‘genesis_default_title’, 10, 3 ); //Default title remove_action( ‘genesis_site_title’, ‘genesis_seo_site_title’ ); //Genesis Extra Stuff remove_action( ‘genesis_site_description’, ‘genesis_seo_site_description’ ); //Genesis Extra Stuff add_filter( ‘wp_title’, ‘genesis_default_title_new’, 10, 3 ); function genesis_default_title_new( $title) { $title=”Hello World!”; return $title; }