Replies: 0
Hi,
I am trying to modify category.php by allowing a custom-post plugin (WP News and Scrolling widget PRO) to show the post instead the standardized system. I have managed to insert a shortcode that allows the plugin to appear. However, it is static, and I want the “pageid” variable in the shortcode to change dynamically to the category it is showing. I have tried as follow:
<?php
/**
* Category Template: Prosjekter
*/
get_header(); ?>
<section id="primary" class="site-content">
<div id="content" role="main">
<?php
// Check if there are any posts to display
if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="archive-title"><?php echo 'category='.'"'.get_cat_ID($_POST['category']).'"';?>archive-header</h1>
<?php
echo "Current Category ID is: " . $cat ;
?>
<?php
// Display optional category description
if ( category_description() ) : ?>
<div class="archive-meta"><?php echo category_description(); ?></div>
<?php endif; ?>
</header>
<?php
// The Loop
while ( have_posts() ) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<div class="entry">
<?php the_excerpt(); ?>
<?php
$cat = 'category='.'"'.get_cat_ID($_POST['category']).'"';
echo do_shortcode( '[sp_news design="design-19" limit="16" grid="4" pagination="true" '.$cat.' show_full_content="false" show_date="false" show_content="true" show_category_name="true" content_words_limit="30" show_read_more="true" content_tail="..." order="DESC" orderby="post_date" link_target="blank" image_height="250"]' );?>
<p class="postmetadata"><?php
comments_popup_link( 'No comments yet', '1 comment', '% comments', 'comments-link', 'Comments closed');
?></p>
</div>
<?php endwhile;
else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>