Jim
Forum Replies Created
-
Thanks, that worked perfectly.
Yes, just like evil-overlord said, it’s simple and obvious, and I thought I had tried it, but I guess I was only clicking on the down arrow before. Thank you!
JimI too am completely stumped with this questions. But the attached video simply shows, very slowly, how to install the plugin.
The documentation just suggests changing the form name with no clues as to where/how.
Could you just state that in text please? Thank you
Forum: Reviews
In reply to: [Simple CSV/XLS Exporter] Does not work with latest versionAnd . . . it actually works great for me with the latest version of WordPress. So take it back! 🙂
Forum: Themes and Templates
In reply to: [GeneratePress] Page title | Site name in headerSorry to belabor this. For some reason the name of the Blog page doesn’t get assigned with get_the_title($post->ID). I’m sure there’s a more straightforward way, but this is what I did to get everything to work:
add_filter( 'generate_site_title_output', 'tu_adjust_site_title' ); function tu_adjust_site_title( $output ) { $site_title = get_bloginfo( 'name' ); $page_name = get_the_title($post->ID); // alter title for all except front page and Blog (home) page if( !( is_front_page() ) && !( is_home() ) ) { $site_title = "{$page_name} | {$site_title}"; } // Blog page if( is_home() ) { $site_title = "Blog | {$site_title}"; } return sprintf( '<%1$s class="main-title" itemprop="headline"> <a href="%2$s" rel="home"> %3$s </a> </%1$s>', ( is_front_page() && is_home() ) ? 'h1' : 'p', esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ), $site_title ); }Forum: Themes and Templates
In reply to: [GeneratePress] Page title | Site name in headerThat did the trick! I just had to kind of reverse the logic and get page name in there.
I don’t quite understand the formatting in the sprintf(); h1 vs. p. On all my pages, including the home/front page (http://109.73.239.174/~cookand3/forestpathology.org/), it seems to be using <p>, and the appearance is the same on all the pages.
Here’s the working filter in case someone else is trying to do the same thing. Thank you so much Tom!
add_filter( 'generate_site_title_output', 'tu_adjust_site_title' ); function tu_adjust_site_title( $output ) { $site_title = get_bloginfo( 'name' ); $page_name = get_the_title($post->ID); // alter title for all but front page if( !(is_front_page()) ) { $site_title = "{$page_name} | {$site_title}"; } return sprintf( '<%1$s class="main-title" itemprop="headline"> <a href="%2$s" rel="home"> %3$s </a> </%1$s>', ( is_front_page() && is_home() ) ? 'h1' : 'p', esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ), $site_title ); }EDIT: Oh, maybe is_home() refers to the Blog page (Posts). There the header text is showing as “| Forest Pathology”. Still not sure why that is.
- This reply was modified 8 years, 4 months ago by Jim.
OK, thank you very much!
Forum: Themes and Templates
In reply to: [GeneratePress] Page title | Site name in headerFYI, I got some feedback from The SEO Framework developer:
https://wordpress.org/support/topic/cant-turn-automated-title-settings-off/#post-9937205It would be nice to have an option to have the header content text be the same as the title tag (although with appropriate styling). Or to explicitly make it page name | site name except for home page.
As far as the need for it, here’s my thinking: the theme provides a way to put nice featured images below the header, which is a beautiful thing. But a good-sized featured image means the content below with page title may not show when the page appears, and the visitor has no indication what page they are on, unless they squint at the browser tab.
Thank you. Here is the filter:
add_filter( 'option_blogname', 'custom_option_blogname' ); function custom_option_blogname( $name ){ $site_name = $name; $page_name = get_the_title($post->ID); if ( is_front_page() ) { return $site_name; } // set title for most? all? pages if( is_page() ) { return "{$page_name} | {$site_name}"; } return $name; }I’m sorry for the confusion; I was playing with that SEO option to remove blog name and left it that way. I’ve switched it back.
Yes, if I remove the filter, with SEO the browser tab is correct and what I want, but the title the theme puts in the header is the site name only.
The filter fixes that, but makes the browser tab have the page title twice, as you see.
Forum: Themes and Templates
In reply to: [GeneratePress] Page title | Site name in headerMaking another assault at this. I do mean the site title in the header area. I finally got it to work with the code below, filtering option_blogname as you suggested Tom. Problem is, now the page title appears twice on the browser tab label.
I think this might be due to a plugin, The SEO Framework, that sets up the browser tab automatically (can’t turn it off). But when I deactivated the plugin, it’s still happening.
add_filter( 'option_blogname', 'custom_option_blogname' ); function custom_option_blogname( $name ){ $site_name = $name; $page_name = get_the_title($post->ID); // set header text for front page if ( is_front_page() ) { return $site_name; } // set title for most? all? pages if( is_page() ) { return "{$page_name} | {$site_name}"; } return $name; }- This reply was modified 8 years, 4 months ago by Jim.
Forum: Themes and Templates
In reply to: [GeneratePress] Page title | Site name in headerUsing the following simple example in functions.php, I’ve gotten what I want to appear in the browser tab (doc title – site name). But how do I get it in the header?
add_filter('document_title_parts', 'my_doc_title', 10); function my_doc_title($title){ $site_name = get_bloginfo( 'name' ); // change title parts here $title['site'] = $site_name; //optional return $title; }- This reply was modified 8 years, 6 months ago by Jim.
Forum: Themes and Templates
In reply to: [GeneratePress] Page title | Site name in headerThanks. I had read about the Yoast capability and didn’t fully follow it, but anyway I’m trying to minimize number of plugins and have no need for SEO.
I think this WordPress function may already do what I want
function wp_get_document_title()
Does it get called to make the title that shows in the header?Forum: Plugins
In reply to: [VS Event List] Change font/sizes in event list?Sorry to be unclear. Putting line feeds in the “custom summary” caused two <p></p> to be added, which by default have 10 px bottom margin, so I had to fix them to have the same margin as all the meta-elements. All fixed. Thank you!
JimForum: Plugins
In reply to: [VS Event List] Change font/sizes in event list?Great idea Guido, thank you. That throws the custom CSS off, but I think I can eventually fix that.