WordPress.org

Ready to get started?Download WordPress

Forums

File Gallery
[resolved] Generating tag pages on the fly broken? (7 posts)

  1. carbeck
    Member
    Posted 2 years ago #

    I've updated to WordPress 3.3 and File Gallery 1.7 yesterday, and suddenly all my media tags were gone. With the Media Tags plugin I somehow managed to restore things so that File Gallery now also recongizes my tagged media again, however generating archive pages for tags on the fly doesn't work anymore for some reason. I've got a file called taxonomy-media_tag.php in my theme's directory with the following contents:

    <?php
    /**
     * The template for displaying Media Tag galleries.
     *
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
     */
    
    get_header(); ?>
    
    <?php
    	$year_term = get_query_var( 'term' );
    ?>
    
    <div id="container">
        <div id="content" role="main">
    
    		<h1 class="entry-title" style="margin-bottom:1em;">Media Archive for “<?php echo $year_term; ?>”</h1>
    
    		<?php
    
    			$opts = array (
    				'order' => 'DESC',
    				'orderby' => 'ID',
    				'size' => 'thumbnail',
    				'link' => 'file',
    				'linkclass' => 'thickbox',
    				'include' => '',
    				'exclude' => '',
    				'template' => 'carsten',
    				'rel' => 1,
    				'tags' => $year_term,
    				'tags_from' => '',
    				'output_type' => 'html',
    				'output_params' => 1,
    				'limit' => -1
    			);
    
    			echo file_gallery_shortcode($opts);
    		?>
    
        </div>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    This made it possible to access e.g. ./archives/media-tag/2011 and get a listing of all files in my media gallery tagged with "2011". However, as I said, this somehow doesn't work anymore and I'm only getting a 404 page.

    Anyone got an idea as for why this might be? Thanks!

    http://wordpress.org/extend/plugins/file-gallery/

  2. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    I'll upload v1.7.1 with a fix tomorrow and explain a bit more about the problem. Thanks for letting me know.

  3. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    File Gallery v1.7.1 is out and fixes wp_rewrite->flush_rules() firing too early on 'init' hook, if any of the permalinks structures were changed.

    About the actual problem: if you have Media Tags plugin installed, it uses 'media-tags' as taxonomy name, not 'media_tag' which is File Gallery default. I've tried my best to make my plugin compatible with Media Tags, and here is how it works:

    - if you have only File Gallery installed, your taxonomy name will by default be 'media_tag'

    - if you install Media Tags, File Gallery will detect that and update taxonomy slug in the database to 'media-tags', as Media Tags plugin has that value hardcoded

    This *should* work without any hiccups. Except for the bug in 1.7, which is now fixed in 1.7.1 - sorry about that :|

    @carbeck: the only thing you need to change (after updating File Gallery to v1.7.1) is your template filename - if you have Media Tags installed, your media tags taxonomy archive filename should be taxonomy-media-tags.php.

    Now, what concerns me more is your first sentence:

    ...suddenly all my media tags were gone
    .

    Did you have Media Tags installed the whole time, or did you install it only after all your media tags disappeared after updating File Gallery?

    Thank you so much for reporting this issue, I hope my post clarifies some things.

    Please let me know if you've managed to make it work :)

  4. carbeck
    Member
    Posted 2 years ago #

    No, I only installed Media Tags to try and fix things. It's currently disabled. I'll see what happens when I update to File Gallery 1.7.1. Thanks for your assistance, anyhow!

  5. carbeck
    Member
    Posted 2 years ago #

    Hm, OK. For some reason, the media-tags taxonomy still stays registered even after uninstalling Media Tags. Is there any way I can get WordPress back to using the media_tag taxonomy and the media-tag slug as previously used by File Gallery? If I direct WP at ./wp-admin/edit-tags.php?taxonomy=media_tag (instead of ?taxonomy=media-tags, which it now prefers), it says "Invalid Taxonomy".

    EDIT: I see that in the File Gallery options there are fields to configure these names, but editing is disabled.

  6. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    @carbeck: you can change media tags taxonomy name in settings -> permalinks under "Media tags Taxonomy name"

  7. carbeck
    Member
    Posted 2 years ago #

    If that's under Settings → Media, the text fields are disabled, as I said. Here's a screenshot: http://i.imgur.com/lziE2.png. Or does this only work with the Media Tags plugin installed and running?

    EDIT: Scratch what I wrote, I looked in the wrong place because I didn't read carefully enough >_<
    EDIT2: Works now :) Awesome, thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic