Brett asked,
This is close to what I want, but I am wondering how to setup a custom field in the site tagline left area for different pages. Much the same as you posted about the right tagline area, but I don’t think I can do exactly the same thing in changing the code.Thanks
In this article I show how we can replace Site Tagline (description) text with value of a custom field in static Pages in Minimum Pro. If the custom field's value is empty, site tagline will appear.
A static Page with the default site tagline text:
Another static Page with custom text in place of the site tagline text:
Install and activate Advanced Custom Fields. Add a Custom Field Group like so:
In functions.php replace
printf( '<div %s>', genesis_attr( 'site-tagline-left' ) ); | |
printf( '<p %s>%s</p>', genesis_attr( 'site-description' ), esc_html( get_bloginfo( 'description' ) ) ); | |
echo '</div>'; |
with
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Very nice Sridhar, thanks.
I presume the print p tags in the code could be changed to h2, 3 or 4 tags.
Or is it not as simple as that?
Yes. It is that simple.
would it be possible to get this to work on a “category” named “Articles”
that I have linked to here http://realestateradioshow.com/articles/
p.s. I have hidden the category in url
to look like this page : http://realestateradioshow.com/past-articles/
Try this for the 2nd block of code: http://pastebin.com/raw.php?i=tB6ZjLXr
Thank you, works great. sweet 🙂 I added your suggested if statement into your above code as second if.
//*————- lines below added for Custom Site Tagline on Pages and a Single specific Category setup in page view
printf( ”, genesis_attr( ‘site-tagline-left’ ) );
$tagline = get_bloginfo( ‘description’ );
if ( is_page() && get_field(‘custom_site_tagline_text’) ) {
$tagline = get_field( ‘custom_site_tagline_text’ );
}
if ( is_category( ‘articles’ ) ) {
$tagline = ‘Knowledge Through Industry Articles’;
}
printf( ‘%s’, genesis_attr( ‘site-description’ ), esc_html( $tagline ) );
echo ”;
Im wondering if we can also set this up to work on single post pages
example http://realestateradioshow.com/12
Hi Sridhar, I am now trying to also add singular post pages to get there own titles based on a catergories like articles and interviews.
This is what i tried but it didnt react. (see third If statement.) first 2 work great.
//*————- lines below added for custom Site Tagline on Pages & Single Catagory using the If
printf( ”, genesis_attr( ‘site-tagline-left’ ) );
$tagline = get_bloginfo( ‘description’ );
if ( is_page() && get_field(‘custom_site_tagline_text’) ) {
$tagline = get_field( ‘custom_site_tagline_text’ );
}
if ( is_category( ‘articles’ ) ) {
$tagline = ‘Knowledge Through Industry Articles’;
}
if ( is_singular( ‘articles’ ) ){
$tagline = ‘Knowledge Through Industry Articles’;
}
printf( ‘%s’, genesis_attr( ‘site-description’ ), esc_html( $tagline ) );
echo ”;
printf( ”, genesis_attr( ‘site-tagline-right’ ) );
genesis_widget_area( ‘site-tagline-right’ );
echo ”;
genesis_structural_wrap( ‘site-tagline’, ‘close’ );
echo ”;
I have a question. Can the ACF plugin be created with using an extra plugin. I guess I mean could it be coded so I could add it to my function.php without another plugin being installed. I really would like to keep the plugins installed down to a certain number.
-Scot
Yes. http://codex.wordpress.org/Custom_Fields
Thank you so much for the great tuts. I am wondering how I can add color to the site title area–I want a colored background to extend across the screen to encompass the primary nav menu and the site title–I saw this done on another Minimum Pro site, but don’t see how to accomplish this within the theme settings.
Thanks for posting this.
How would the code change if I also wanted to this custom text to show up for posts? The code changes in function.php are just for pages? I want custom text on ALL pages and posts.
Thanks!
BJL
Great post Sridhar, Thank You!
Is it possible to make this a WYSIWYG field instead of a Text field?
Thanks
Bob
[…] How to Replace Site Tagline on pages in Minimum Pro with Custom Text Using Advanced Custom Fields […]
Great tutorial! I noticed a comment above where you gave code to print a different tagline for a specific category, but I would like to know if it would be possible to include code that would instead just print the category name in place of tagline. Could you (or anyone) point me in the right direction of what code to include?
Many thanks!
Wanted to share an update that I was able to get the category to show with :
if ( is_category() ) {
$tagline = single_cat_title();
}
Wondering if there is a way to include this onto all posts tagged with Blog and also the portfolio pages, atm all those pages just have the blank area.