harjeet singh
Forum Replies Created
-
I guess the $post_count was supposed to be equal to 0 , like
<?php if ($post_count == 0) { ?>
It serves for me . I don’t have much knowledge of php so can explain much , but it has served my purpose.
After applying the code provided by you i got this error.
Parse error: parse error, expecting `'(” in C:\wamp\www\
After modifying the code to
<?php if ($post_count > 0) { ?>
The error was not there but the error Sorry, no posts matched your criteria. was also not showing up.
Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpThanks MichaelH.
That was a great help.
You Rock man ….Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpMy Problem is that i want to retrieve values of category id from database for in_category(array). the following works fine.
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php $cat = array(5,6);
if ( in_category($cat) ) { ?>
its working
<?php } else { ?>
its not working
<?php } ?>
<?php endwhile; endif; ?>I just want to replace
<?php $cat = array(5,6);
with the variable holding value from database
<?php $cat = array($include_cat);
Hope this clears everything
Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpthe only problem is
retrieving value from database for in_category(array)
. There must be a way to sort it out.
Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpis_category doesn’t display anything…..
Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpbut i tried to enter id of one category in database . then the code works fine and includes the new page. the id’s are separated with ‘,’i.e 5,6
This works fine withquery_posts(“showposts=8&cat=$include_category”
Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helptried both with array
if (in_category(array($include_category))) { ?>
and without array
if (in_category($include_category)) { ?>
But still it passes to else command
Forum: Fixing WordPress
In reply to: inserting database value in in_category(array)Code of the page is
<?php
global $options;
foreach ($options as $value) {
if (get_settings( $value[‘id’] ) === FALSE) { $$value[‘id’] = $value[‘default’]; } else { $$value[‘id’] = get_settings( $value[‘id’] ); } }
?>
<?php get_header(); ?>
<div id=”container”>
<?php get_sidebar(); ?>
<div id=”content”>
<div class=”content-top”></div>
<div class=”content-middle”>
<?php echo"<pre>"; print_r($wp_gallery_include_category); echo "</pre>";
$cat_include = array($include_category);
if (in_category($cat_include)) { ?>
<?php include(TEMPLATEPATH . ‘/new-page.php’); ?>
<?php } else { echo ‘nothing’ ; }?>
</div><!– content_middle closed –>
<div class=”content-bottom”></div>
<?php if ( comments_open() ) : ?>
<div id=”comments_wrap”>
<?php comments_template(); // Get wp-comments.php template ?>
</div>
<?php endif; ?>
</div><!– content closed–></div><!– container closed–>
<?php get_footer(); ?>Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpThis is the total code..
<?php global $options; foreach ($options as $value) { if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['default']; } else { $$value['id'] = get_settings( $value['id'] ); } } ?> <?php get_header(); ?> <div id="container"> <?php get_sidebar(); ?> <div id="content"> <div class="content-top"></div> <div class="content-middle"> <?php echo "<pre>"; print_r($include_category); echo "</pre>"; $cat_include = array($include_category); if (in_category($cat_include)) { ?> <?php include(TEMPLATEPATH . '/new-page.php'); ?> <?php } else { echo 'nothing' ; }?> </div><!-- content_middle closed --> <div class="content-bottom"></div> <?php if ( comments_open() ) : ?> <div id="comments_wrap"> <?php comments_template(); // Get wp-comments.php template ?> </div> <?php endif; ?> </div><!-- content closed--> </div><!-- container closed--> <?php get_footer(); ?>
The results are there when typing
<?php echo
"<pre>"; print_r($include_category); echo "</pre>"; ?>
Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpOne more thing i have to use the following code also to get the values
<?php
global $options;
foreach ($options as $value) {
if (get_settings( $value[‘id’] ) === FALSE) { $$value[‘id’] = $value[‘default’]; } else { $$value[‘id’] = get_settings( $value[‘id’] ); } }
?>Forum: Fixing WordPress
In reply to: inserting database value in in_category(array)Here is the code
<?php $cat_include = array($include_category);
if (in_category($cat_include)) { ?>
<?php include(TEMPLATEPATH . ‘/new-page.php’); ?> <?php } else { echo ‘nothing’ ; }?>Forum: Fixing WordPress
In reply to: in_category(array) problem…plz helpThanks for the reply i checked using your code to display the result and the values from database were returned – 5,6