• Hi All,
    My Requirement
    I have a list of categories displayed on the sidebar and each category has a check box. Users can select the categories they want and click on one of the two buttons(or links) call ‘All’ and ‘Any’ which will then forward to one of the two php pages (lets call them allcat.php and anycat.php)
    Depends upon what they click I need to show them a list of posts (as well as a custom rss feed) to posts belonging to All or Any of the categories.

    What I have so far
    Given below is my Allcat.php file

    <?php get_header(); ?>
    <?php
    $featuredPosts = new WP_Query();
    $featuredPosts->query(array('category__and' => array(3,4)));
    while ($featuredPosts->have_posts()) : $featuredPosts->the_post();
    ?>
    	<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
    	<div class="meta">
    	By <?php the_author() ?>
    	</div>
    	<div class="storycontent">
    	<?php the_excerpt(); ?>
    	</div>
    <?php endwhile; ?>
    <?php get_footer(); ?>

    My Questions
    1. How do I call the Allcat.php file?
    In a regular php page I would just use the relative path and call it href=”Allcat.php” or something like that. But in WP due to url rewrites and everything category.php is called as https://www.example.com/category/mycat1/. So how should I call my Allcat.php?
    2. How to pass the selected checkbox values to the Allcat.php?
    Should I just use POST and submit the form that the checkboxes are in? Would that word with WP?

    Extra
    My main problem is how WP won’t allow to combine categories like tags. (how ‘tag1+tag2’ would give posts with both the tags) So if someone has an answer to that question, like a plugin to get that functionality to categories please let me know.

    Thanks in advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to link to a new theme php file?’ is closed to new replies.