ThemeShaper Forums » Thematic

[closed]

Dear Helga, this Image Menu - could it be possible?

(4 posts)
  • Started 7 years ago by d_rec
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. Kind of like this jQuery version of a menu http://www.alohatechsupport.net/webdesignmaui/maui-web-site-design/create_image_menu_with_jquery.html now I can hard code it but would like to pull this out dynamically using WP's own menu set-up. Could this be possible with Thematic and if Yes, could you point me in the right direction so I can learn please.

    I'll give it a go myself using this post as reference; http://forums.themeshaper.com/topic/thematic-menus-demystified-1

    derek

    Posted 7 years ago #
  2. well my boilerplate answer is: everything is possible eventually. the html markup isn't any different from default WP, so you won't have the difficult part of creating a new Walker.

    you will need a special/unique class for each menu item, but you can add that in the dashboard. if you don't see it when you are using the menu, then you probably need to adjust its visibility... top right gray box that says Screen Options.

    css should be easy to copy in. then you'll need to fire up the special jquery. see my post on that:
    http://forums.themeshaper.com/topic/jquery-in-thematic-demystified

    Posted 7 years ago #
  3. Thanks, I did find some info sort of relevant to my quest from kwight somewhere down this post; http://forums.themeshaper.com/topic/using-featured-image-dynamically-in-css and that deals with the Walker Class. Where I searched and found this explanation; http://wpti.ps/functions/extending-wordpress-walker-class/

    I'll get side tracked on this and wonder if I should replace the p tags using this(they say something about HTML5);

    // unautop for images
    function fb_unautop_4_img( $content ) {
        $content = preg_replace(
            '/<p>\\s*?(<a rel=\"attachment.*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s',
            '<figure>$1</figure>',
            $content
        );
        return $content;
    }
    add_filter( 'the_content', 'fb_unautop_4_img', 99 );

    found here; http://wpengineer.com/2264/replace-p-tag-on-images-in-content-of-wordpress/

    Then I found this bit of code that adds the Featured Image to the post and page in WP back-end.

    if ( !function_exists('fb_AddThumbColumn') && function_exists('add_theme_support') ) {
    	// for post and page
    	add_theme_support('post-thumbnails', array( 'post', 'page' ) );
    	function fb_AddThumbColumn($cols) {
    		$cols['thumbnail'] = __('Thumbnail');
    		return $cols;
    	}
    	function fb_AddThumbValue($column_name, $post_id) {
    			$width = (int) 35;
    			$height = (int) 35;
    			if ( 'thumbnail' == $column_name ) {
    				// thumbnail of WP 2.9
    				$thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
    				// image from gallery
    				$attachments = get_children( array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image') );
    				if ($thumbnail_id)
    					$thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true );
    				elseif ($attachments) {
    					foreach ( $attachments as $attachment_id => $attachment ) {
    						$thumb = wp_get_attachment_image( $attachment_id, array($width, $height), true );
    					}
    				}
    					if ( isset($thumb) && $thumb ) {
    						echo $thumb;
    					} else {
    						echo __('None');
    					}
    			}
    	}
    	// for posts
    	add_filter( 'manage_posts_columns', 'fb_AddThumbColumn' );
    	add_action( 'manage_posts_custom_column', 'fb_AddThumbValue', 10, 2 );
    	// for pages
    	add_filter( 'manage_pages_columns', 'fb_AddThumbColumn' );
    	add_action( 'manage_pages_custom_column', 'fb_AddThumbValue', 10, 2 );
    }

    Which is kind of handy to see what has an image or not. I found this by reading Devin's Portfolio Theme's code.

    Next on my list will be to go through the code for the Nivo-Slder from Return-True and see if I can modify that in some form. I got this slider working so I'm guessing, it's only a different jQuery being called.

    I don't need to use this code/slider for my site, just trying to learn.

    Posted 7 years ago #
  4. is confused. why do you need to add featured images to backend columns or remove P from images in the content for that menu?

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.