Forum Replies Created

Viewing 8 replies - 61 through 68 (of 68 total)
  • Plugin Author cip

    (@cip)

    Hi!

    We have updated the plugin to support passing a category id to setup_ec_data method. So please, update to v1.0.2 and use the code bellow:

    foreach($categories as $category) {
        $GLOBALS['enhanced_category']->setup_ec_data($category->term_id);
        the_post_thumbnail( 'thumbnail');
    }

    PS: It would really help us a 5 stars rating :). Cheers!

    Plugin Author cip

    (@cip)

    Hi!

    Have you noticed and managed to read the installation section of the plugin page? Enhanced Category Pages – Installation

    The basic idea is to use $enhanced_category global variable that our plugin sets, more specifically: $enhanced_category->setup_ec_data() – this call gets enhanced category post and set it up as global current post. From this point forward global $post is the enhanced page.

    Using your code to show the content and the enhanced of the enhanced page of the category:

    <?php global $wp_query;
    /**
     * The template for displaying Category pages.
     */
    
    get_header(); ?>
    
    	<section id="primary" class="site-content">
    		<div id="content" role="main">
    
    			<header class="archive-header">
    				<h1 class="archive-title"><?php echo single_cat_title( '', false ); ?></h1>
    			</header><!-- .archive-header -->
    
    		    <?php
    		        global $enhanced_category;
    		        //get enhanced category post and set it up as global current post
    		        $enhanced_category->setup_ec_data();
    		    ?>
    
    		    <!-- enhanced category content -->
    
    		    <!-- featured image -->
    		    <?php the_post_thumbnail("medium"); ?>
    
    			<!-- content -->
    			<?php the_content(); ?>
    
    			<?php 
    
    			if ( have_posts() ) :
    
    				// The default query for this page
    				$args = $wp_query->query;
    
    				// Get the blog template
    				get_theme_blog_template( $args );
    
    			endif; 
    
    			?>
    		</div><!-- #content -->
    	</section><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I hope I managed to explain it to you so you can create great projects using Enhanced Category Pages.

    PS: We would appreciate a 5 Star if have found the plugin useful.

    Plugin Author cip

    (@cip)

    @theremingenieur, please refer to WordPress Template Hierarchy: https://codex.www.ads-software.com/Template_Hierarchy

    WordPress allows you to customize category pages by creating category.php template. This is not included in Twenty Fifteen theme, by default (as also suggested by template WordPress hierarchy), the archive.php is used if category.php is not found.

    So, do create category.php. You can combine archive.php and code provided above and in installation section of the plugin to have a nice category page.

    Here is an example of such a category template: https://pastebin.com/SBUzS1BE

    Le me know if it worked for you. With some basic WordPress template programming, it should work.

    BTW, we also offer premium programming services if you require so.

    Plugin Author cip

    (@cip)

    Hey, there!

    We have released a new version (1.0.1) that adds support to enhance any taxonomy term.

    Cheers!

    Plugin Author cip

    (@cip)

    The proposed code uses a best practice of having separated files for content i.e. content-page.php

    In the code there is a call:
    <?php get_template_part( 'content', 'page' ); ?>

    This tries to include content-page.php.

    Try to replace this with:
    the_content()
    this should show the formatted content.

    The call:
    $enhanced_category->setup_ec_data();
    setsup the global $post variable, so you can use bellow the call any regular WP display functions (similar to any other page) e.g. the_title(), the_content(), etc.

    Bonus: Here is an example of content-page.php

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    	</header><!-- .entry-header -->
    
    	<div class="entry-content">
    		<?php the_content(); ?>
    		<?php
    			wp_link_pages( array(
    				'before' => '<div class="page-links">' . __( 'Pages:', 'needadrenaline' ),
    				'after'  => '</div>',
    			) );
    		?>
    	</div><!-- .entry-content -->
    
    	<footer class="entry-footer">
    		<?php edit_post_link( __( 'Edit', 'needadrenaline' ), '<span class="edit-link">', '</span>' ); ?>
    	</footer><!-- .entry-footer -->
    </article><!-- #post-## -->

    Plugin Author cip

    (@cip)

    Hi!

    It seems that it is not the content of the enhanced category that is displayed. but the excerpt (not all content is visible). If this is the case, the excerpt does not contain html tags, so this is why.

    What is the code in content-page.php? That is where the content/excerpt is being displayed.

    Plugin Author cip

    (@cip)

    Thank you!

    As I suspected you are using PHP 5.3. We fixed the PHP 5.4 requirement, so, version 0.2 should work for you, too.

    Note: anyway, please, consider upgrading your PHP. PHP 5.3.x is no longer a recommended version for production.

    Some details regarding the fix: we used array dereferencing that was introduced in PHP 5.4.

    PS: thank you for your valuable feedback.
    PS2: would appreciate a 5 star rating if it works.

    Plugin Author cip

    (@cip)

    Hi!

    Thank you for trying our plugin and your appreciation.

    We are here to help. Can you give more details regarding your environment, e.g. PHP version, other plugins installed etc.?

    Cheers

Viewing 8 replies - 61 through 68 (of 68 total)