2 column blog shortcode - no meta data

resolved (16 posts) (2 voices)

  1. wouthe
    Member

    Hello,

    When I insert a blog with 3 columns using the blog-shortcode, post meta is displayed. So the data, author and comments.
    When I insert a blog with 2 (two) columns, nothing is displayed.

    See: http://www.caesarsreport.com/blog2/blogposts/ (Up = 2 columns > Down = 3 columns)

    These are the shortcodes on that page:

    [divider] [blog_grid column="2" showposts="10" post_content="excerpt" category_in="6,10,4,10" pagination="true"]
    
    [blog_grid column="3" showposts="12" post_content="full" category_in="6,10,4" pagination="true"]

    Is this a bug in the theme?

    And if I may ask a second question, would it be possible to only display the data? So disable author and comments?

    Thanks

    Posted 6 months ago #
  2. wouthe
    Member

    I found this code, but that's not what I'm looking for.

    I would like to display the date under the title of each post (like it does in the 3 column layout)

    add_action( 'mysite_before_entry', 'custom_post_meta', 100);
     function custom_post_meta()
     {
    	global $mysite;
    
    	$date = the_time('F j, Y');
    	return '<p>' . $date . '</p>';
     }
    Posted 6 months ago #
  3. wouthe
    Member

    If you allow me, I will launch a third question. I would also like to display dates in the archives.

    Under the title in the grid, so you can see when this post was made really quick.

    Here is a link to the archive, and as you can see dateless: http://www.caesarsreport.com/blog2/2011/11/

    It is important for me to just show dates in the blog grid (under the title), so you can easily overview when everything was posted.
    Thanks so much for helping me out!

    Posted 6 months ago #
  4. Elliott
    Support

    Hello wouthe,

    That is correct in how it displays, http://themes.mysitemyway.com/elegance/blog/blog-shortcodes/. When using 3 columns or more the fancy_meta will be disabled and the meta will display beneath the post title just because there's not enough room in the image.

    Is this how you are wanting it for the column 1 & 2 layouts also?

    Posted 6 months ago #
  5. wouthe
    Member

    Hi Elliott,

    Thank you for that link, I'll check there first before I say it could be a bug...

    Yes you are right, I would like to display meta (but only the date) beneath the title. Why? Because in 2 column layouts I often do NOT use a featured image, and then there is no meta data displayed.

    In the link examples (http://themes.mysitemyway.com/elegance/blog/blog-shortcodes/) every blog post has an image. But if they would not, there would be no meta at all in 1 and 2 column layouts.

    It would be great if you could help me with this, but if not, I might use a 3-column layout... but I'd love to use a 2-column.

    Check the attachment if my explanation would be unclear.

    Attachments

    1. MY1.gif (84.8 KB, 1 downloads) 6 months old
    Posted 6 months ago #
  6. Elliott
    Support

    Alright, open up /wp-content/themes/elegance/framework.php and on line 516 you should see this,

    global $mysite;

    On the next line add this,

    add_action( 'mysite_before_entry', 'mysite_post_meta' );
    return;

    That should take the fancy_meta off and use the regular post meta. And you can find the components of the post meta in /wp-content/themes/[your_theme]/lib/functions/theme.php on lines 1213 - 1220,

    if( !in_array( 'date_meta', $_meta ) )
    	$meta_output .= '[post_date text="' . __( '<em>Posted on:</em>', MYSITE_TEXTDOMAIN ) . ' "] ';
    
    if( !in_array( 'comments_meta', $_meta ) )
    	$meta_output .= '[post_comments text="' . __( '<em>With:</em>', MYSITE_TEXTDOMAIN ) . ' "] ';
    
    if( !in_array( 'author_meta', $_meta ) )
    	$meta_output .= '[post_author text="' . __( '<em>Posted by:</em>', MYSITE_TEXTDOMAIN ) . ' "] ';

    Just comment out or delete whatever you don't need.

    Posted 6 months ago #
  7. wouthe
    Member

    Thanks so much Elliott.

    It all works great, except the date is still not displayed in one or two-column layouts.
    Do you think there is an easy fix for that?

    (You can see an example of how it is now here http://www.caesarsreport.com/blog2/blogposts/ )

    This would make it just perfect!

    Posted 6 months ago #
  8. Elliott
    Support

    Around line 511 in /wp-content/themes/[your_theme]/framework.php you should see the fancy_meta function. Change it like this,

    if ( !function_exists( 'mysite_fancy_meta' ) ) :
    /**
     *
     */
    function mysite_fancy_meta( $args = array() ) {
    	global $mysite;
    
    	$meta_output = '[post_date format="M j Y"] ';
    	$out .= '<div>' . $meta_output . '</div>';
    
    	echo do_shortcode($out);
    }
    endif;
    Posted 6 months ago #
  9. wouthe
    Member

    Hm it's not doing it.

    I'm trying to copy the code for 3 and 4 column layouts to 1 and 2, but without succes.
    I find it strange that it's so hard to get 1 and 2 column blogs to appear the same as 3 and 4.

    I know I'm asking for a lot here... do you do custom work? I'm willing to pay to get these customizations done.
    Thanks again.

    Posted 6 months ago #
  10. wouthe
    Member

    Actually, it's working for all list-blogs, and 3 - 4 grid blogs.

    Only for 1 and 2 grid-blogs it's not working. And since you can use a list blog instead of a 1 column grid blog, only the 2-column grid blog is not displaying as I want it.

    If you would have a solution, you would make my week. If not, I'll try to find a coder, or maybe just go with the 3-column blog.

    Posted 6 months ago #
  11. Elliott
    Support

    Which page is it not working on? I checked your link again but the date is displaying fine, http://www.caesarsreport.com/blog2/2011/11/.

    Posted 6 months ago #
  12. wouthe
    Member

    Hi Elliott,

    Check this page at the bottom. http://www.caesarsreport.com/blog2/blogposts/

    Only for 1 & 2-column grid blogs it does not work.

    These are the shortcodes on the page;

    [blog_grid column="3" showposts="12" post_content="excerpt" category_in="19,6,4,10,17,18" pagination="true" disable="image"]
    
    xxx
    
    [divider][blog_grid column="2" showposts="10" post_content="excerpt" category_in="6,10,4,10" pagination="true" disable="image"]

    I did not replace the mysite_fancy_meta with

    if ( !function_exists( 'mysite_fancy_meta' ) ) :
    /**
     *
     */
    function mysite_fancy_meta( $args = array() ) {
    	global $mysite;
    
    	$meta_output = '[post_date format="M j Y"] ';
    	$out .= '<div>' . $meta_output . '</div>';
    
    	echo do_shortcode($out);
    }
    endif;

    beacause that did not work.

    I think we need some code to also place meta in a 1 and 2 grid-blog under the title. That would be great!
    Thanks!

    - - - - - - - - - - - Edit - - - - - - - - - - -

    I've also just seen that only for the November archive dates are shown: http://www.caesarsreport.com/blog2/2011/11/

    For October and September archives, no dates are shown: http://www.caesarsreport.com/blog2/2011/10/ + http://www.caesarsreport.com/blog2/2011/09/

    Do you have any how to fix this?
    Thanks again, I really appreciate your help!

    Posted 6 months ago #
  13. Elliott
    Support

    Go ahead and delete any customizations that have been done, (download a fresh copy of the file), and then redo this one,

    http://mysitemyway.com/support/topic/2-column-blog-shortcode-no-meta-data#post-37624

    Posted 6 months ago #
  14. wouthe
    Member

    I deleted:

    if ( !function_exists( 'mysite_fancy_meta' ) ) :
    /**
     *
     */
    function mysite_fancy_meta( $args = array() ) {
    	global $mysite;
    
    	extract( $args );
    
    	$out = '';
    
    	$post_id = get_the_ID();
    	$type = get_post_type( $post_id );
    	$post_thumbnail_id = get_post_thumbnail_id( $post_id );
    	$auto_img = mysite_get_setting( 'auto_img' );
    
    	$layout = $mysite->layout['blog'];
    	$featured = ( isset( $layout['featured'] ) ) ? $layout['featured'] : '';
    	$index = ( isset( $index ) ) ? $index : '';
    
    	if( !empty( $column ) ) {
    		$layout['blog_layout'] = '';
    		$featured = '';
    		$index = 1;
    	}
    
    	if ( ( empty( $post_thumbnail_id ) ) && ( !$auto_img[0] ) || ( $layout['blog_layout'] == 'blog_layout2' && !empty( $mysite->is_blog ) ) ) {
    		add_action( 'mysite_before_entry', 'mysite_post_meta' );
    		return;
    	}
    
    	if ( ( empty( $post_thumbnail_id ) ) && ( $auto_img[0] ) ) {
    		$attachments = get_children(array(
    			'post_parent' => $post_id,
    			'post_status' => 'inherit',
    			'post_type' => 'attachment',
    			'post_mime_type' => 'image',
    			'order' => 'ASC',
    			'orderby' => 'menu_order ID',
    			'numberposts' => 1
    		));
    
    		if ( empty( $attachments ) ) {
    			add_action( 'mysite_before_entry', 'mysite_post_meta' );
    			return;
    		}
    	}
    
    	if( !empty( $shortcode ) && strpos( $disable, 'meta' ) !== false ) return;
    
    	$meta_options = mysite_get_setting( 'disable_meta_options' );
    	$_meta = ( is_array( $meta_options ) ) ? $meta_options : array();
    	$meta_output = '';
    
    	if( ( !empty( $featured_post ) ) || ( $layout['blog_layout'] == 'blog_layout1' ) || ( $column == 1 ) || ( $thumb == 'large' ) || ( is_single() ) ) {
    		if( !in_array( 'author_meta', $_meta ) )
    			$meta_output .= '[post_author] ';
    
    		if( !in_array( 'date_meta', $_meta ) )
    			$meta_output .= '[post_date format="M j Y"] ';
    
    		if( !in_array( 'categories_meta', $_meta ) )
    			$meta_output .= '[post_terms taxonomy="category"]';
    
    		if( !empty( $meta_output ) )
    			$out .= '<div class="fancy_meta" style="display:none;">' . $meta_output .'</div>';
    
    	} elseif( $column != 3 && $column != 4 ) {
    
    		if( !in_array( 'author_meta', $_meta ) )
    			$meta_output .= '[post_author] ';
    
    		if( !in_array( 'date_meta', $_meta ) )
    			$meta_output .= '[post_date format="M j Y"] ';
    
    		if( !empty( $meta_output ) )
    			$out .= '<div class="fancy_meta" style="display:none;">' . $meta_output .'</div>';
    	}
    
    	if( $type == 'portfolio' ) {
    		$out = '';
    		$_date = get_post_meta( $post_id, '_date', true );
    		if( !empty( $_date ) )
    			$meta_output = '<span class="meta_date">' . $_date . '</span>';
    		else
    			$meta_output = '';
    
    		if( !empty( $meta_output ) )
    			$out = '<div class="fancy_meta" style="display:none;">' . $meta_output . '</div>';
    	}
    
    	echo apply_atomic_shortcode( 'fancy_meta', $out );
    }
    endif;

    and added:

    if ( !function_exists( 'mysite_fancy_meta' ) ) :
    /**
     *
     */
    function mysite_fancy_meta( $args = array() ) {
    	global $mysite;
    
    	$meta_output = '[post_date format="M j Y"] ';
    	$out .= '<div>' . $meta_output . '</div>';
    
    	echo do_shortcode($out);
    }
    endif;

    I think this is what you mean?

    This makes it worse. All dates in the Archives are gone, http://www.caesarsreport.com/blog2/2011/11/ and I get double dates when images are turned on: http://www.caesarsreport.com/blog2/reports/

    Posted 6 months ago #
  15. Elliott
    Support

    No just go ahead and delete the framework.php file and upload a fresh copy and then do this, http://mysitemyway.com/support/topic/2-column-blog-shortcode-no-meta-data#post-37624.

    It'd probably be best if you hired a freelancer as it's kind of bordering on custom work anyway.

    Posted 6 months ago #
  16. wouthe
    Member

    That's what I did indeed. I used a fresh copy.

    Ok, yeah I had the feeling it was going to be custom work.
    I'll look around for a freelancer.
    Thanks for al your time Elliott!

    Posted 6 months ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme