WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Subfolders in submenu

[Resolved] Subfolders in submenu

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author klihelp

    @klihelp

    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;
    }

    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.

    Plugin Author klihelp

    @klihelp

    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.

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Subfolders in submenu’ is closed to new replies.