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.

 
You must be logged in to post
Search Forums:


 






Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Gallery/Image description/keywords

Post
New Member

tekiedude

posts 1

5:43 pm June 23, 2009

Post edited 11:47 pm – June 23, 2009 by tekiedude


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

Admin

WordPress Professional

Raleigh, NC

posts 442

11:54 am July 3, 2009

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


About the WordPress Developer Forum

Forum Timezone: America/New_York

Most Users Ever Online: 205

Currently Online:
30 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 5
Forums: 23
Topics: 1543
Posts: 3447

Membership:

There are 6357 Members

There are 4 Admins
There are 3 Moderators