Is there a way I could control multiple Meta Descriptions? | Feature Requests - All in One SEO Pack Pro | Support | Semper Plugins

Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Is there a way I could control multiple Meta Descriptions?
July 1, 2014
11:54 pm
Avatar
Kyler Boudreau
Member
Guests
Forum Posts: 47
Member Since:
April 30, 2014
sp_UserOfflineSmall Offline

A month or two ago you guys helped me implement code to my functions.php file to enable Advanced Custom Field data to be pulled into a Title tag automatically as well as a Meta Description.

My problem now is I have more than one custom post type that I want to create a meta description for. I’ve tried to modify the code you gave me to make it work for two, but I just white screened the site. =)

Could you show me how to tweak? Also, it would be awesome to have the description fields available for custom post types like you’ve made the title fields available in the GUI.

Here’s the current code:

/* All in one SEO mods */

function sfwd_acf_field_replace( $matches ) {
$result = ”;
if ( !empty( $matches ) ) {
if ( !empty( $matches[1] ) ) {
if ( function_exists( ‘get_field’ ) ) $result = get_field( $matches[1] );
if ( empty( $result ) ) {
global $post;
if ( !empty( $post ) ) $result = get_post_meta( $post->ID, $matches[1], true );
}
if ( empty( $result ) ) $result = $matches[0];
}
else $result = $matches[0];
}
return $result;
}

function sfwd_acf_fields( $format ) {
return preg_replace_callback( ‘/%cf_([^%]*?)%/’, ‘sfwd_acf_field_replace’, $format );
}

add_filter( ‘aioseop_title’, ‘sfwd_acf_fields’ );
add_filter( ‘aioseop_description’, ‘sfwd_acf_fields’ );
add_filter( ‘aiosp_opengraph_meta’, ‘sfwd_acf_fields’ );

/* All in one SEO description mods */
add_filter( ‘aioseop_description’, ‘sfwd_default_description’, 1 );
function sfwd_default_description( $desc ) {
if ( is_singular( ‘ogs’ ) ) {
if ( empty( $desc ) ) $desc = “Looking for essential oils? Check out this Certified Oily Guru located in %cf_city%, %cf_state%.”;
}
return $desc;
}

/* End All in one SEO mods */

July 2, 2014
10:19 am
Avatar
Peter Baylies
Admin
Forum Posts: 578
Member Since:
October 16, 2011
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

July 2, 2014
11:00 pm
Avatar
Kyler Boudreau
Member
Guests
Forum Posts: 47
Member Since:
April 30, 2014
sp_UserOfflineSmall Offline

NICE!!!!!!! Thank you. That code worked beautifully.

July 2, 2014
11:05 pm
Avatar
Kyler Boudreau
Member
Guests
Forum Posts: 47
Member Since:
April 30, 2014
sp_UserOfflineSmall Offline

I’m trying to pull in the title of the post type into the above code. I’ve tried these things:

%cf__aioseop_title%

%cf_aioseop_title%

%cf_title%

None of those will do it. Do you have any ideas?

——-

BTW…You know I love you guys, so this isn’t about comparing: The Yoast plugin allows people to do what I’m doing with any CPT description right from the plugin admin. I just don’t want you guys to lose business from “silent” people who compare and don’t ask about the feature.

July 3, 2014
10:24 am
Avatar
Peter Baylies
Admin
Forum Posts: 578
Member Since:
October 16, 2011
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

July 11, 2014
12:28 pm
Avatar
Kyler Boudreau
Member
Guests
Forum Posts: 47
Member Since:
April 30, 2014
sp_UserOfflineSmall Offline

Peter,

Sorry for responding so late. You know how you can enable advanced options for custom post types in AIOSEO? And when you check that box, for each custom post type you have enabled, it provides a title meta field to pre-fill out for those CPTs?

That’s what I’m saying for the description meta too. When you click advanced you have a title and description field for each custom post type.

Let me know if that doesn’t make sense. For example: my brother’s car dealership — each new vehicle he adds to inventory is a custom post type. And since all the cars all have makes, models, engine sizes, etc. then it’s awesome to pull those custom fields into the title and description for great SEO on the fly.

July 11, 2014
1:21 pm
Avatar
Peter Baylies
Admin
Forum Posts: 578
Member Since:
October 16, 2011
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

Forum Timezone: America/New_York

Most Users Ever Online: 964

Currently Online:
29 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 35

Members: 20442

Moderators: 1

Admins: 8

Forum Stats:

Groups: 4

Forums: 28

Topics: 1941

Posts: 8338

Newest Members:

Lori Gama

Moderators: Dawa Liu

Administrators: Michael TorbertPeter BayliesSupport TeamSteve MortiboyMatthew RobinsonSteve KlasenArnaud BroesAshish Ravi

[i]
[i]
Skip to toolbar