single post title depenting in in_category All in One SEO Pack Troubleshooting Forum

The support forums have a new home! Please visit All in One SEO Pack's new residence at Semper Plugins to purchase a support plan.

Please consider registering
guest

Log In

Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

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

Topic RSS
single post title depenting in in_category
July 12, 2009
11:37 am
inwedes
New Member
Forum Posts: 6
Member Since:
July 12, 2009
Offline

hi, i have tryed to ad some case check into my header to add a keyword in the front of the title tag directly in php depending on category

when all in one seo is installed, my code has no effect, deaktivated this plugin my code works

how the title tag i manipulated my this plugin, where i can add my wished keyword to the front of a single post page when in_category(podt_ID) results in true

ot: this forum, or the mod_rewrite has a bug

i wrote a feature request with title starting with %category_desc…%
this results in this url, and it seam that the rewrite role cant solve that
someone forgotten to check the first carachter too, the % from within the string has been removed, but the first one breaks the link
i'm sure this forum has ids via get too, so it can be found in the db ?!
http://semperfiwebdesign.com/f…..itle/#p315

July 12, 2009
2:59 pm
hallsofmontezuma
Admin
Forum Posts: 202
Member Since:
June 8, 2009
Offline

You must be a subscriber to view administrator posts. Click here to purchase a support subscription.

For what shall it profit a man, if he shall gain the whole world, and lose his own soul?
July 12, 2009
6:11 pm
inwedes
New Member
Forum Posts: 6
Member Since:
July 12, 2009
Offline

ok, thank you

it was the first time i'm using a filter an for thouse with similar (no)skills and some ideas here my sample code to manipulate the title based on a category

/**

this is from http://codex.wordpress.org/Fun…..n_category

 * Tests if any of a post's assigned categories are descendants of target categories
 *
 * @param mixed $cats The target categories. Integer ID or array of integer IDs
 * @param mixed $_post The post
 * @return bool True if at least 1 of the post's categories is a descendant of any of the target categories
 * @see get_term_by() You can get a category by name or slug, then pass ID to this function
 * @uses get_term_children() Gets descendants of target category
 * @uses in_category() Tests against descendant categories
 * @version 2.7
 */

function post_is_in_descendant_category( $cats, $_post = null )
{
    foreach ( (array) $cats as $cat ) {
        // get_term_children() accepts integer ID only
        $descendants = get_term_children( (int) $cat, 'category');
        if ( $descendants && in_category( $descendants, $_post ) )
            return true;
    }
    return false;
}

/*

 *
 * here comes my come line of code
 *
 */

function mycustom_aiosplugin_single_post_title($aiosplugin_title) {
    global $id, $post;

// i only want to change the title on single post pages
if ( is_single() ) {

    // and only for this categories or their sub-categorie i want to add some keyword
    if ( in_category( array( 'category_slug', 'or_an_other_or_the_id', 4) ) || post_is_in_descendant_category( array( 'slug', 'slug', CatID) ) ) {

        // here i put my keyword in $r
        $r = 'my keyword, ';
};

// this returns the new title where i add $r to the front of the title as set in the all in one seo plugin
return $r.' '. $aiosplugin_title;
}
// this make it connect to the wordpress system
add_filter('single_post_title','mycustom_aiosplugin_single_post_title');

ok, this is realy realy simple to those making this ofter

maybe it helps somebody like me

July 12, 2009
6:21 pm
WordPress Professional
Admin
Forum Posts: 442
Member Since:
October 14, 2008
Offline

You must be a subscriber to view administrator posts. Click here to purchase a support subscription.

For what shall it profit a man if he shall gain the whole world and lose his own soul
July 12, 2009
6:30 pm
inwedes
New Member
Forum Posts: 6
Member Since:
July 12, 2009
Offline

no no

i wanted to add an additional keyword/phrase to single post page titles depending on categories this posts are

this would be a very nice feature in the option of this plugin

..selection categories with specific within the all in one seo options
..and then add a  'rule' link it is now in the options but depending on each category the posts are

is pm or mail possible?

July 12, 2009
6:40 pm
WordPress Professional
Admin
Forum Posts: 442
Member Since:
October 14, 2008
Offline

You must be a subscriber to view administrator posts. Click here to purchase a support subscription.

For what shall it profit a man if he shall gain the whole world and lose his own soul
July 12, 2009
8:15 pm
inwedes
New Member
Forum Posts: 6
Member Since:
July 12, 2009
Offline

hm, i try to explain, my english is poor i think

i use wordpress for produkcts and recipe to this products (a shop for gift bastest will follow)

now i have many 3 level categories in the recipes
my toplevel cat "recipe" seperated products and recipe posts

now i had have a simple if put the german word for recipe followed by an comma and a whitespace in front of each title of a singe-post page from the top category recipe

this was lost after starting with seo using your plugin :-)

with you help and some googel i hooked my category-based 'prefix' in the titles from your plugin
so i have all the features and flexibility of your plugin and i have in all recipes singel pages the main keyword for seo-matters in the title of these pages (i would not to put it in all post titles in the db, this would be ugly and boring, evey h1 on the page would start with "recipes, …..", for googl-bot and the google seach results its a plus)

July 12, 2009
10:58 pm
WordPress Professional
Admin
Forum Posts: 442
Member Since:
October 14, 2008
Offline

You must be a subscriber to view administrator posts. Click here to purchase a support subscription.

For what shall it profit a man if he shall gain the whole world and lose his own soul
Forum Timezone: America/New_York

Most Users Ever Online: 205

Currently Online:
32 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

romiojuliat: 102

yaoming987: 50

jintuy: 50

miki1986: 33

newshow: 28

karen1234: 27

Member Stats:

Guest Posters: 0

Members: 6356

Moderators: 3

Admins: 4

Forum Stats:

Groups: 5

Forums: 23

Topics: 1546

Posts: 3450

Newest Members: carofern@cisco.com, pronto, jessie, pbaylies, ninaeast, freda

Moderators: davecashmore (2), aaron (5), tempadmin (0)

Administrators: WordPress Professional (442), hallsofmontezuma (202), onefinejay (10), stevemortiboy (4)