Loading...


Loading...

Welcome!

Sign up for a free account, or log in here.

Member Login

You can login by following the link.

Not a Member? Sign up! It's Free!

Please feel free to register.

Click to log in.

1 comment

How to Create Keywords from NextGen Gallery

Today I ran into a problem with the csv_tags() function. This is quite common in WordPress themes and lets the header.php create the keywords meta tag on the fly. But, one caveat, it’s usually used by creating the keywords from the tags on the page, and so only used on single post pages or pages.

Also, GRS has moved to use the NextGEN gallery plugin on the front page (and category pages). This has caused a bit of a problem since they now use a page as the front page. Since the posts on the front page are specifically coded to not display tags, the csv_tags() functions doesn’t work properly.

So I had to alter it, and thought a better way of doing this would be to check for the NextGEN gallery and use the alt text. Here is the new altered csv_tags() function:

function csv_tags() {
 if (is_home() || is_front_page()) {
  global $wpdb;
  $results = $wpdb->get_results(‘SELECT alttext FROM wp_ngg_pictures WHERE galleryid = 1 AND exclude = 0′);
  foreach ($results as $row) {
   $csv_tags .= $row->alttext . ‘,’;
  }
 } else {
  $posttags = get_the_tags();
  foreach((array)$posttags as $tag) {
   $csv_tags .= $tag->name . ‘,’;
  }
 }
 echo ‘<meta name=”keywords” content=”‘.$csv_tags.’” />’;
}

Comments

kossi kpetigo says:

Very great idea.. Because the tags are very important and should be used as keyword by default- Thanks..



Leave a Reply



You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


The English Guy on Twitter

Raised Paper WordPress Theme

Raised Paper WordPress Theme screenshot
Theme Price

Onyx WordPress Theme

Onyx WordPress Theme screenshot
Theme Price

Victoriana WordPress Theme

Victoriana WordPress Theme screenshot
Theme Price

Expression Blue WordPress Theme

Expression Blue WordPress Theme screenshot
Theme Price

Premium WordPress Theme Release: Natural Green

Premium WordPress Theme Release: Natural Green screenshot
Theme Price

Theme Release: Ikon WordPress Theme

Theme Release: Ikon WordPress Theme screenshot
Theme Price

Shocking WordPress Theme Release

Shocking WordPress Theme Release screenshot
Theme Price

Digitalis WordPress Theme Release

Digitalis WordPress Theme Release screenshot
Theme Price

WordPress Theme: OpenAir Theme

WordPress Theme: OpenAir Theme screenshot
Theme Price

WordPress Theme: Very English

WordPress Theme: Very English screenshot
Theme Price

News Print v3.0 WordPress Theme Released

News Print v3.0 WordPress Theme Released screenshot
Theme Price

Reclamation WordPress Theme

Reclamation WordPress Theme screenshot
Theme Price