WordPress.org

Ready to get started?Download WordPress

Forums

Eazyest Gallery
[resolved] Subfolders in submenu (5 posts)

  1. Martijn
    Member
    Posted 11 months ago #

    Hi,

    Is it possible to show subfolders only after a visitor clicks a main item in the main category?
    I have a lot of subfolders now, so that the menu is very expansive: see kleurplatennl [ dot ] nl.

    I would like this to work like http://www [dot] supercoloring [dot] com/

    Thanks!

    http://wordpress.org/plugins/eazyest-gallery/

  2. klihelp
    Member
    Plugin Author

    Posted 11 months ago #

    Hope this function helps:

    my_ezg_subfolders_links();
    or
    my_ezg_subfolders_links( $postID, 'hash', 'data-any:"thing"' )

    /* my_ezg_subfolders_links()
    *
    * post_id - parent post id
    * type - hash OR no-hash
    * data - include additional attributes string
    *
    */
    
    function my_ezg_get_subfolders_links( $post_id = 0, $type = 'no-hash', $data = '' ) {
    	$output = '';
    
    	list( $orderby, $order ) = explode( '-', eazyest_gallery()->sort_by() );
    	$children = get_children( array(
    		'numberposts' => -1,
    		'post_parent' => $post_id,
    		'post_type'   => eazyest_gallery()->post_type,
    		'order' => $order,
    		'orderby' => $orderby,
    		'post_status' => array( 'publish', 'inherit' )
    		));
    
    	foreach ( $children as $post ) {
    		$output .= "<li><a href=". ( $type == 'hash' ? $post->guid : "#{$post->post_name}");
    		$output .= " data-id= $post->ID ";
    		if ( $type == 'hash' )
    			$output .= " data-href= $post->guid ";
    		if ( $data )
    			$output .= " {$data}";
    		$output .= ">{$post->post_title}</a></li>";
    	}
    
    	return $output;
    
    }
    
    function my_ezg_subfolders_links( $post_id = 0, $type = 'no-hash', $data = '' ) {
    
    	echo my_ezg_get_subfolders_links( $post_id, $type , $data );
    	return;
    }
  3. Martijn
    Member
    Posted 11 months ago #

    Thanks!
    Can you help me where to put the code?

    I also tried the Folding Category List plugin, but this is only working for the standard WP categories.

  4. klihelp
    Member
    Plugin Author

    Posted 11 months ago #

    You put the code part into the functions.php.
    And you call the function in your theme, in the header.php but this is depends of your design. This function only outputs the subfolders in a raw html list, ready to use programatically.

  5. Martijn
    Member
    Posted 11 months ago #

    Thanks.
    I am using the theme that I want now (plaintxtBlog), but I have no clue how to actually program this.
    I would be very grateful to get some help.

    The standard Eazyest subfolder menu is used now, but it is way too long. Also I tried to move all of the images of the subfolders to the main folder, but then it will be a chaos inside the folders.

    Thanks for you help.

Reply

You must log in to post.

About this Plugin

About this Topic