Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Chribba68

    (@chribba68)

    Thanks so much for your time and help Michael! That worked! The only thing left to clean up was the “from” – 5 posts from January 2016, which I found further up in

    case 'month':
    $archive_title = __('from', 'loc_canon');
    $archive_subject = get_the_time('F Y');
    $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);break;

    at first I tired removing ‘from’ but that resulted in the entire page being blank! I then only removed the word from, leaving ”

    case 'month':
     $archive_title = __('', 'loc_canon');
     $archive_subject = get_the_time('F Y');
     $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject); break;

    and that gave a nice clean archive heading F Y, in this case January 2016.

    Thanks again – you are officially the first (and only) person to help me here and it means a lot! 🙂

    Thread Starter Chribba68

    (@chribba68)

    Thanks for replying Michael! Here is the code for the entire php. I’m using a theme called Enoki. Quick follow-up question: In order to not lost this customization in a theme update (I have a child theme) what exactly do I do? Thanks again!

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    <?php
    
    	//VARS
    	$canon_options_post = get_option('canon_options_post'); 
    
    	// DETERMINE PAGE TYPE (home, page or category)
    	$page_type = mb_get_page_type();
    
        // SET TITLE STRING
        switch ($page_type) {
            case 'category':
                $archive_title = __('in category', 'loc_canon');
                $archive_subject = single_cat_title('', false);
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            case 'tag':
                $archive_title = __('tagged', 'loc_canon');
                $archive_subject = single_tag_title('', false);
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            case 'search':
                $archive_title = __('searching for', 'loc_canon');
                $archive_subject = get_search_query();
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            case 'author':
                $archive_title = __('by', 'loc_canon');
                $archive_subject = get_the_author_meta('display_name',$wp_query->post->post_author);
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            case 'day':
                $archive_title = __('from', 'loc_canon');
                $archive_subject =  get_the_time('d/m/Y');
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            case 'month':
                $archive_title = __('from', 'loc_canon');
                $archive_subject = get_the_time('F Y');
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            case 'year':
                $archive_title = __('from', 'loc_canon');
                $archive_subject = get_the_time('Y');
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            case 'tax':
                $archive_title = __('in group', 'loc_canon');
                $archive_subject = get_query_var('term');
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
            default:
                $archive_title = __('browsing', 'loc_canon');
                $archive_subject = __('Unknown', 'loc_canon');
                $archive_title_string = sprintf('%s <span>%s</span>', $archive_title, $archive_subject);
                break;
        }
    
        $num_posts_found = $wp_query->found_posts;
        $num_posts_found_postfix = ($num_posts_found == "1") ? __("post", "loc_canon") : __("posts", "loc_canon");
        if ($page_type == "search") { $num_posts_found_postfix = ($num_posts_found === 1) ? __("result", "loc_canon") : __("results", "loc_canon"); }
        $num_posts_found_string = sprintf('%s %s', esc_attr($num_posts_found), esc_attr($num_posts_found_postfix) );
    
        // SET CONTROLLER CLASSES
        $controller_classes = "is-col-1-1 not-boxed is-classic not-dropcap not-sidebar";
        $controller_classes .= " not-full";
    
    ?>
    
    			<div class="outter-wrapper clearfix archive-header <?php echo esc_attr($controller_classes); ?>">
    
    				<!-- SUMMARY -->
    				<?php if (!($page_type == "category" && $canon_options_post['show_cat_title'] != "checked")) { printf('<h1 class="sepTitle"><span>%s %s</span></h1>', esc_attr($num_posts_found_string), wp_kses_post($archive_title_string)); } ?>
    
    				<?php if ($page_type == "author") : ?>
    
    				<?php
    
    				    $author_description = get_the_author_meta('description');
    				    $author_description = (!empty($author_description)) ? $author_description : __("This author has not supplied a bio yet.","loc_canon");
    
    				?>
    
    					<!-- AUTHOR BOX -->
    					<div class="postAuthor">
    
    						<div class="postAuthor-inner">
    
    							<?php echo get_avatar(get_the_author_meta('ID'), 72, '', 'author-avatar'); ?>
    
    							<h3><?php the_author_posts_link(); ?></h3>
    
    							<p><?php echo wp_kses_post($author_description); ?></p>
    
    							<div class="author-social">
    
    								<ul class="socialList">
    									<?php if ( get_the_author_meta('user_url') ) { printf( '
    <li><a href="%s"><em class="fa fa-globe"></a></li>
    ', esc_url(get_the_author_meta('user_url')) ); } ?>
    									<?php if ( get_the_author_meta('facebook') ) { printf( '
    <li><a href="%s"><em class="fa fa-facebook"></a></li>
    ', esc_url(get_the_author_meta('facebook')) ); } ?>
    									<?php if ( get_the_author_meta('twitter') ) { printf( '
    <li><a href="%s"><em class="fa fa-twitter"></a></li>
    ', esc_url(get_the_author_meta('twitter')) ); } ?>
    									<?php if ( get_the_author_meta('googleplus') ) { printf( '
    <li><a href="%s"><em class="fa fa-google-plus"></a></li>
    ', esc_url(get_the_author_meta('googleplus')) ); } ?>
    									<?php if ( get_the_author_meta('linkedin') ) { printf( '
    <li><a href="%s"><em class="fa fa-linkedin"></a></li>
    ', esc_url(get_the_author_meta('linkedin')) ); } ?>
    
    							</div>
    
    						</div>	
    
    					</div>
    
    				<?php endif; ?>
    
                    <?php $category_description = category_description(); ?>
    
                    <?php if ( $page_type == "category" && $canon_options_post['show_cat_description'] == "checked" && !empty($category_description) ) : ?>
    
                        <!-- CATEGORY DESCRIPTION -->
                        <div class="category-description">
    
                            <div class="category-description-inner">
    
                                <?php echo wp_kses_post($category_description); ?>
    
                            </div>
    
                        </div>
    
                    <?php endif; ?>
    
    			</div>
Viewing 2 replies - 1 through 2 (of 2 total)