Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter kiparks

    (@kiparks)

    Thanks, its a suitable workaround.

    Thread Starter kiparks

    (@kiparks)

    <disclaimer> I am no expert in this </disclaimer> but here’s more on what I did:

    The PHP code snippet I gave in above is within a <div> like this:
    <div id="categories-and-tags" class="masonry-loop js-masonry">

    To make the categories display like masonry blocks, and to tell the site which elements to display like blocks, they have to have a parent div with the class masonry-loop. To activate the loop, the following code is in my header.php:

    <script type="text/javascript">
    			jQuery(window).load(function() {
    			// MASSONRY Without jquery
    			var container = document.querySelector('.masonry-loop');
    			var msnry = new Masonry( container, {
    				gutter:		20,
    				itemSelector: '.post-container',
    				columnWidth: '.post-container',
    				percentPosition: true,
    			});
            	});
    	</script>

    Your CSS is identical to mine, and I don’t know what your site looks like, but if your’s displays differently than mine I think it might be the necessary header script and using the right parent element.

    As a bonus here’s the code I used to display the tags underneath. It appears directly under the categories code within the masonry-loop div. (The .home-special tag uses some simple CSS to change the font/background-color)

    <div class="home-special post-container hometag"><div class="post"><div class="post-inner">Browse Most Used Tags  →</div></div></div>
    					<?php $tags = get_tags(array('orderby' => 'count','number' => '5','order' => 'DESC'));
    						foreach ( $tags as $tag ) {
    							echo '<div class="post-container"><div class="post"><div class="post-inner hometag">'.
    							'<a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a>'.
    							'</div></div></div>';
    						}
    					?>

    Thread Starter kiparks

    (@kiparks)

    <disclaimer> I am no expert in this </disclaimer> but here’s more on what I did:

    The PHP code snippet I gave in above is within a <div> like this:
    <div id="categories-and-tags" class="masonry-loop js-masonry">

    To make the categories display like masonry blocks, and to tell the site which elements to display like blocks, they have to have a parent div with the class masonry-loop. To activate the loop, the following code is in my header.php:

    <script type="text/javascript">
    			jQuery(window).load(function() {
    			// MASSONRY Without jquery
    			var container = document.querySelector('.masonry-loop');
    			var msnry = new Masonry( container, {
    				gutter:		20,
    				itemSelector: '.post-container',
    				columnWidth: '.post-container',
    				percentPosition: true,
    			});
            	});
    	</script>

    Your CSS is identical to mine, and I don’t know what your site looks like, but if your’s displays differently than mine I think it might be the necessary header script and using the right parent element.

    As a bonus here’s the code I used to display the tags underneath. It appears directly under the categories code within the masonry-loop div. (The .home-special tag uses some simple CSS to change the font/background-color)

    <div class="home-special post-container hometag"><div class="post"><div class="post-inner">Browse Most Used Tags  →</div></div></div>
    					<?php $tags = get_tags(array('orderby' => 'count','number' => '5','order' => 'DESC'));
    						foreach ( $tags as $tag ) {
    							echo '<div class="post-container"><div class="post"><div class="post-inner hometag">'.
    							'<a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a>'.
    							'</div></div></div>';
    						}
    					?>

    Thread Starter kiparks

    (@kiparks)

    Nevermind, I solved the problem using some code found elsewhere. For anyone’s reference, here’s what I used so that each category was wrapped in my pre-styled <div>s to allow them to be easily positioned/styled.

    `<?php $categories= get_categories();
    foreach ($categories as $cat) {
    echo ‘<div class=”post-container”><div class=”post”><div class=”post-inner”>’.
    ‘<div class=”post-header” style=”text-align:center”>’.
    ‘<h3 class=”page-title” style=”margin-bottom:5px”><a href=”‘.get_category_link($cat->cat_ID).'”>’.$cat->cat_name.'</a></h3>’.
    ‘<div class=”home-postcount”>’.'(‘.$cat->category_count.’ projects)’.'</div>’.
    ‘</div>’.
    $cat->description.
    ‘</div></div></div>’;
    }
    ?>`

    Thread Starter kiparks

    (@kiparks)

    Thanks! The code worked, although I did adjust it slightly. (I put it below in case anyone else was interested)

    if ( ! function_exists( 'generatechild_entry_meta' ) ) :
    /**
     * Prints HTML with meta information for the categories, tags.
     *
     * @since 1.2.5
     */
    function generatechild_entry_meta()
    {
    	$categories = apply_filters( 'generate_show_categories', true );
    	$tags = apply_filters( 'generate_show_tags', true );
    	$comments = apply_filters( 'generate_show_comments', true );
    
    	if ( 'post' == get_post_type() ) {
    
    		$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generate' ) );
    		if ( $categories_list && $categories ) {
    			printf( '<span class="cat-meta">Posted in: <span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span></span>',
    				_x( 'Categories', 'Used before category names.', 'generate' ),
    				$categories_list
    			);
    		}
    
    		$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generate' ) );
    		if ( $tags_list && $tags ) {
    			printf( '<span class="tags-meta">Tagged: <span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span></span>',
    				_x( 'Tags', 'Used before tag names.', 'generate' ),
    				$tags_list
    			);
    		}
    	}
    
    	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) && $comments ) {
    		echo 'Comments: <span class="comments-link">';
    		comments_popup_link( __( 'Leave a comment', 'generate' ), __( '1 Comment', 'generate' ), __( '% Comments', 'generate' ) );
    		echo '</span>';
    	}
    }
    endif;

    And I set up the css to display it like so:

    .cat-meta,
    .tags-meta{
      display: block;
    }
    
    .cat-links,
    .tags-links{
      display: inline;
    }

    Thanks again!

    Thread Starter kiparks

    (@kiparks)

    Thanks for the quick reply! I’m already using a custom CSS plugin for the smaller tweaks I did and now I’ll add this fix too.

    Thread Starter kiparks

    (@kiparks)

    Well I fixed it (I have dumb ol’ DSO for a PHP handler so I have to be extra mindful of permissions). I just changed the permissions for the uploads folders.

    Thanks.

    (and smart crop was already on btw)

    Thread Starter kiparks

    (@kiparks)

    not yet. Others have had similar problems with other themes so I thought I’d try here before I ask the theme-makers directly.

Viewing 8 replies - 1 through 8 (of 8 total)