Topic: WP-Juicebox addSEOContent="TRUE" not working

I've updated WP-Juicebox to version 1.3.1 and Juicebox-Pro 1.3.1 and most new features are working great!  However, the addSEOContent="TRUE" feature doesn't seem to be working.

Here is a link to view a gallery in which this is the case:
http://acquaphoto.com/

When you view source code, it doesn't show the "Image gallery content for non-javascript devices" and the accompanying search engine friendly code.

Any advice on how I might get it to display the SEO content?  Thanks in advance for the help, I am really loving the new features!

Re: WP-Juicebox addSEOContent="TRUE" not working

Add SEO Content is not a configuration option that can be added to a gallery's XML file.
It is a feature only of JuiceboxBuilder-Pro and the SEO code is generated at the time the gallery is created (not when the gallery is displayed).
You would need to manually embed your Juicebox-Pro gallery in your WordPress post (using the baseUrl method of embedding) and copy and paste the SEO content (generated by JuiceboxBuilder-Pro) along with the embedding code into the body of your WordPress post (ensuring that the method of entry is 'Text' rather than 'Visual).

Re: WP-Juicebox addSEOContent="TRUE" not working

Sorry to revive an older post, but I was having an issue with this.  Steven, where would I find the SEO content that JBPro generated?

Re: WP-Juicebox addSEOContent="TRUE" not working

@maxphoto

The SEO content can be found in the gallery's 'index.html' file between the <noscript></noscript> tags (below the following comment):

<!-- Image gallery content for non-javascript devices -->

Make sure that you are using the latest version of JuiceboxBuilder-Pro (v1.3.2) and that you have selected the 'Add SEO Content' checkbox in the 'Customize -> Sharing' section.
If you need to upgrade your version of JuiceboxBuilder-Pro, please see the Upgrading Juicebox page for details.

Re: WP-Juicebox addSEOContent="TRUE" not working

@Steven

No dice- I'm sure I'm doing something wrong, but I upgraded to 1.3.2, made a new gallery to test, made sure SEO Content was checked, and saved.  When I open the index.html file in textedit, I see the gallery name in bold at top, "Gallery Description" directly below that, and then the image names and captions.  There is no <noscript> tag or any other text at all.

Re: WP-Juicebox addSEOContent="TRUE" not working

and then the image names and captions

If you are seeing the image names and captions in the gallery's 'index.html' file, then this is the SEO content.
If you deselect the 'Add SEO Content' checkbox and re-save the gallery, you will see that the image names and captions are no longer included in the gallery's 'index.html' file.
If you do not see the <noscript> tags or the HTML comment I posted above, then perhaps your text editor is hiding them from view.
Make sure your text editor is set to display plain text.

Re: WP-Juicebox addSEOContent="TRUE" not working

Thanks, Steven.  TextEdit was not displaying plain text. As always, I really appreciate your help!

If anyone in the future has this problem, go to TextEdit's Preferences and switch from Rich text to Plain text, then check Ignore rich text commands in HTML and uncheck Add ".txt" extension to plain text files.  Close TextEdit, and reopen and you'll be set.

Re: WP-Juicebox addSEOContent="TRUE" not working

Sorry to be a problem child here, but although the <noscript> SEO stuff is showing up in TextEdit, when I upload and view the source code on my website, it's not there.  Any ideas?  Here's a link to the source code.
view-source:http://www.maxphotostudio.c … /#expanded

Re: WP-Juicebox addSEOContent="TRUE" not working

The SEO code is not included in the embedding code provided in JuiceboxBuilder-Pro's 'Publish' tab.
If you are embedding the gallery in an existing web page alongside other content and want the SEO code to be included in the web page you will need to copy and paste the embedding code and the SEO code from the gallery's 'index.html' file (not just the embedding code from JuiceboxBuilder-Pro).

Re: WP-Juicebox addSEOContent="TRUE" not working

Got it.  Would I just copy/paste the contents of the <noscript> tags (including the tags)?

Re: WP-Juicebox addSEOContent="TRUE" not working

Yes. Copy and paste everything between the <!--START JUICEBOX EMBED--> and <!--END JUICEBOX EMBED--> comments (including the <noscript></noscript> tags).

Re: WP-Juicebox addSEOContent="TRUE" not working

It's actually really easy to get the plugin to create it's own SEO content if your galleries are all created with Wordpress (as opposed to using external resources like Flickr.  With minimal effort, the post attachments that make up the SEO content can be retrieved from WordPress, and the specific values that make up the SEO content can be added to the output of the shortcode_handler method.

1) Create a class property at the top of the Juicebox class:

var $attachments = array();

2) Modify the shortcode_handler method:

$string_builder .= '<div id="juicebox-container-' . $gallery_id . '">' . PHP_EOL;
global $post;
$this->attachments = array();
$this->get_attachments_media(TRUE, $post->ID);
if (!empty($this->attachments)) {
    $string_builder .= '<noscript>' . PHP_EOL;
    foreach ($this->attachments as $id => $attachment)
    {
        $string_builder .= '<p>' . $attachment->post_title . '<br />';
        $string_builder .= wp_get_attachment_image( $id, 'full', false );
        $string_builder .= '</p>' . PHP_EOL;
    }
    $string_builder .= '</noscript>' . PHP_EOL;
}
$string_builder .= '</div>' . PHP_EOL;

3) Replace the contents of the Juicebox class's get_attachment_media method with this:

if (empty($this->attachments)) {
    if ($featured_image === 'true') {
        $this->attachments = get_children(array('post_parent'=>$post_id, 'post_type'=>'attachment', 'post_mime_type'=>'image', 'orderby'=>'menu_order', 'order'=>'ASC'));
    } else {
        $this->attachments = get_children(array('post_parent'=>$post_id, 'post_type'=>'attachment', 'post_mime_type'=>'image', 'orderby'=>'menu_order', 'order'=>'ASC', 'exclude'=>get_post_thumbnail_id($post_id)));
    }
}
$this->attachments = array_filter($this->attachments, array(&$this, 'filter_image_media'));
return $this->attachments;

I know that hacking the plugin like this isn't desirable because if the plugin is updated these changes will get wiped out, but it just goes to show that there is a simple solution if you are just using WordPress galleries and not external image sources.

Re: WP-Juicebox addSEOContent="TRUE" not working

@temec987

Thank you for sharing your solution.

Re: WP-Juicebox addSEOContent="TRUE" not working

temec987, do you mind sharing the complete code/file? I'm not familair with PHP, but really interested in your solution!

Re: WP-Juicebox addSEOContent="TRUE" not working

Click here [Link removed.] to download temec987's solution integrated into the 'wp-juicebox.php' file from the current version of WP-Juicebox (v1.4.2).

Just unzip the file into your 'wp-content/plugins/wp-juicebox/' directory, overwriting the existing 'wp-juicebox.php' file.

Please note that this is not an official solution, it is untested by myself, it will work only for galleries which use the Media Library as the source of images and it may not be possible to integrate the code posted above into future versions of WP-Juicebox (as the source code is subject to change).

Having said that, I hope it helps you out.

Re: WP-Juicebox addSEOContent="TRUE" not working

Thanks Steven! Do I have to rebuild all juicebox galleries? Since my site doesn't load when I replace the file. Hmm maybe I just keep hoping for a future supported implementation.

Re: WP-Juicebox addSEOContent="TRUE" not working

Sorry. It looks like there was a problem with the original file.
Please try downloading the file again (different file, same link as before). It should work this time (and there is no need to rebuild any galleries - all you need to do is swap the 'wp-juicebox.php' file).

Re: WP-Juicebox addSEOContent="TRUE" not working

Thanks so much! Works like a charm!

Re: WP-Juicebox addSEOContent="TRUE" not working

Hi Steven, would it be possible for you to provide the adjusted 'wp-juicebox.php' file for the latest release? Highly appreciated!

Re: WP-Juicebox addSEOContent="TRUE" not working

Try this 'wp-juicebox.php' file.
It should hopefully work fine as a replacement for the 'wp-juicebox.php' file from the current version of WP-Juicebox (v1.5.0).
However, please remember that this is not an official solution and you should use the file at your own risk. The code was provided by a member of the forum community and it has not been extensively tested with v1.5.0.

Re: WP-Juicebox addSEOContent="TRUE" not working

Thanks so much!

Re: WP-Juicebox addSEOContent="TRUE" not working

You're welcome!