Gallery/Image description/keywords All in One SEO Pack Feature Requests 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
Gallery/Image description/keywords
June 23, 2009
5:43 pm
tekiedude
New Member
Forum Posts: 1
Member Since:
June 23, 2009
Offline

I made some modifications to the pack and would like to suggest that you add the option to write descriptions for gallery attachments.  It might be helpful to others and perhaps be added as a new feature

Here's code I added to function rewrite_title right before the is_single() test

                } else if (is_attachment()) { //if an attachment get post parent description
                        $title = get_the_title($post->post_parent).” “.$post->post_title.” – “.get_option('blogname');
                        $header = $this->replace_title($header,$title);

function get_all_keywords was modified like so:

                        //$id = $post->ID;
                         //   $keywords_i = stripcslashes($this->internationalize(get_post_meta($post->ID, “keywords”, true)));
                        $id = (is_attachment())?($post->post_parent):($post->ID); // if attachment then use parent post id
                            $keywords_i = stripcslashes($this->internationalize(get_post_meta($id, “keywords”, true)));
further down

                        if (function_exists('get_the_tags')) {
                                //$tags = get_the_tags($post->ID);
                                $tags = get_the_tags($id); //use ID from above

further down

                        //$autometa = stripcslashes(get_post_meta($post->ID, “autometa”, true));
                        $autometa = stripcslashes(get_post_meta($id, “autometa”, true)); // use ID from above

further down

                                //$categories = get_the_category($post->ID);
                                $categories = get_the_category($id); //use ID from above

in the main function wp_head I added code to make the description unique so you don't get dinged by google for duplicate meta descriptions.  Right before this line add the code below and change the line

            $meta_string .= sprintf(”<meta name=\\”description\\” content=\\”%s\\” />”, $description);

add

                // added to produce diff meta descriptions in image gallery as images usually have numbers plus URLs tend to use dates
                // get any numbers in the image name and append them to the description

                if(get_option('aiosp_can')){
                        $url = $this->aiosp_mrt_get_url($wp_query);
                                if ($url) {
                                preg_match_all('/(\\d+)/', $url, $matches);
                                        if (is_array($matches)){
                                                $uniqueDesc = join('',$matches[0]);
                                        }
                        }
                $description .= ” “.$uniqueDesc;
                }

hope this helps someone

July 3, 2009
11:54 am
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:
58 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)