Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Thread Starter knalstaaf

    (@knalstaaf)

    Solved: added <?php wp_reset_query(); ?> in front of the part that was causing the issue.

    Thread Starter knalstaaf

    (@knalstaaf)

    I solved it with a bit of luck on the internet: adding <?php wp_reset_query(); ?> on top of the second box solves the problem:

    <?php wp_reset_query(); ?>
    
    <?php if ( is_home() || is_404() ) { ?>;
    	this should appear on the homepage (and 404)
    <?php } elseif ( is_archive() ){ ?>;
    	this not, but yet it does.
    <?php } ?>;

    Source

    Thanks for guiding me to the right trail, esmi (loops).

    Thread Starter knalstaaf

    (@knalstaaf)

    I’ve been breaking my head over it, with no progress. Is there another way in which I can achieve the same result, but with another method?

    I also remarked there this is_archive in both blocks. But it seems like it’s considering the homepage is an is_archive as well?!

    When I remove it in the second block on the very bottom, like this

    <?php if ( is_home() || is_404() ) { ?>;
    	this should appear on the homepage (and 404)
    <?php } elseif ( is_archive() ){ ?>;
    	this not, but yet it does.
    <?php } ?>;

    it works on the single page, but it appears on the homepage as well! Can someone help me out here? (I’m using the Arthemia theme, if this would be of any relevance)

    Thread Starter knalstaaf

    (@knalstaaf)

    Like I said: If I erase all the rest, except for the second block in the bottom of that code, being

    <?php if ( is_home() || is_archive() || is_404() ) { ?>
    	<div id="dsfsdf">
    		<script type="text/javascript"><!--
    			google_ad_client = "pub-006913815847188";
    			/* 300x250, created 6-2-09 (o) */
    			google_ad_slot = "6514371817";
    			google_ad_width = 300;
    			google_ad_height = 250;
    			//-->
    			</script>
    			<script type="text/javascript"
    			src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
    		</script>
    	</div>
    	<?php } elseif ( is_single() ){ ?>
    	    something else
    	<?php } ?>

    it actually works. So I thinks the code conflicts somewhere, somehow. Any idea on what’s going wrong there?

    Thread Starter knalstaaf

    (@knalstaaf)

    Is there a way I can break this loop on top of the sidebar? (tried <?php endwhile;?>, <?php endif ?> and <?php rewind_posts(); ?> with no luck)

    Thread Starter knalstaaf

    (@knalstaaf)

    You know, I’m not an expert, but I don’t believe it’s loop-related after doing some read on that link.

    Another funny thing: it used to work locally on my computer (PHP 5.2.6), but not online (PHP 5.2.10). I’ve upgraded my local system to PHP 5.2.10. Doesn’t work locally either now ??

    Not that it should have something to do with it. A well written piece of PHP should work on any upgrade.

    Thread Starter knalstaaf

    (@knalstaaf)

    Funny thing is, if the second block goes on top of the sidebar, it works… But that’s not its proper place ofcourse.

    I’ll post the full sidebar here, maybe some php-pro can see where it’s going wrong here (meanwhile reading “multiple loops”, esmi):

    <div id="mond">
    
    	<?php if ( is_single() || is_page() || is_paged() || is_search() || is_archive() || is_404() ) { ?>
    	<div class="dfg">
    		<p class="gfg"><strong>Brekend</strong></p>
    		<?php query_posts("showposts=4&category_name=decay"); $i = 1; ?>
    	    <?php while (have_posts()) : the_post(); ?>
    		<div class="gdrg">
    			<?php $values = get_post_custom_values("Image");
    			if (isset($values[0])) { ?>
    		      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    			<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
    		$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=106&h=65&zc=1&q=100"
    		alt="<?php the_title(); ?>" class="left" width="99px" height="62px"  /></a>
    		      <?php } ?>
    			<div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><strong><?php the_title(); ?></strong></a>
    				<div class="una">[<?php the_time('j M Y') ?> | <?php comments_popup_link('0 reacties', '1 reactie', '% reacties');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>
    			</div>
    	   	</div>
    	    <?php endwhile; ?>
    	</div>
    	<?php } ?>
    
    	<div id="tur">
    		<script type="text/javascript"><!--
    			google_ad_client = "pub-0010673412010";
    			/* 300x250, gemaakt 8-6-09 */
    			google_ad_slot = "3614536814";
    			google_ad_width = 300;
    			google_ad_height = 250;
    			//-->
    		</script>
    		<script type="text/javascript" src="https://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
    	</div>
    
    	<div id="sdfdsf">
    	<?php include (TEMPLATEPATH . '/searchform.php'); ?>
    	<?php 	/* Widgetized sidebar, if you have the plugin installed. */ 					if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?>
    	<?php endif; ?>
    	</div>
    	<div id="sdfsd">
    	<?php 	/* Widgetized sidebar, if you have the plugin installed. */ 					if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(4) ) : ?>
    	<?php endif; ?>
    	</div>
    	<div id="dsffdss">
    	<?php 	/* Widgetized sidebar, if you have the plugin installed. */ 					if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?>
    	<?php endif; ?>
    	</div>
    
    	<div id="dqsf">
    		<h3>match</h3>
    		<?php query_posts('cat=4&showposts=5'); ?>
    		<ul>
    		  <?php while (have_posts()) : the_post(); ?>
    		  <li><a href="<?php the_permalink() ?>"><strong><?php the_title(); ?></strong></a></li>
    		  <?php endwhile;?>
    		</ul>
    		<h3>quick</h3>
    		<?php query_posts('cat=3&showposts=5'); ?>
    		<ul>
    			<?php while (have_posts()) : the_post(); ?>
    			<li><a href="<?php the_permalink() ?>"><strong><?php the_title(); ?></strong></a></li>
    			<?php endwhile;?>
    		</ul>
    	</div>  
    
    	<?php if ( is_home() || is_archive() || is_404() ) { ?>
    	<div id="dsfsdf">
    		<script type="text/javascript"><!--
    			google_ad_client = "pub-006913815847188";
    			/* 300x250, created 6-2-09 (o) */
    			google_ad_slot = "6514371817";
    			google_ad_width = 300;
    			google_ad_height = 250;
    			//-->
    			</script>
    			<script type="text/javascript"
    			src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
    		</script>
    	</div>
    	<?php } elseif ( is_single() ){ ?>
    	    something else
    	<?php } ?>
    </div>
    Thread Starter knalstaaf

    (@knalstaaf)

    (Btw the echoes don’t work either, it was a rather general advice I was asking). The full code:

    First block:

    <?php if ( is_single() || is_page() || is_paged() || is_search() || is_archive() || is_404() ) { ?>
    <div class="dfg">
    	<p class="gfg"><strong>Brekend</strong></p>
    	<?php query_posts("showposts=4&category_name=Featured"); $i = 1; ?>
        <?php while (have_posts()) : the_post(); ?>
    	<div class="gdrg">
    		<?php $values = get_post_custom_values("Image");
    		if (isset($values[0])) { ?>
    	      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    		<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
    	$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=100&h=65&zc=1&q=100"
    	alt="<?php the_title(); ?>" class="left" width="99px" height="62px"  /></a>
    	      <?php } ?>
    		<div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><strong><?php the_title(); ?></strong></a>
    			<div class="una">[<?php the_time('j M Y') ?> | <?php comments_popup_link('0 reacties', '1 reactie', '% reacties');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>
    		</div>
       	</div>
        <?php endwhile; ?>
    </div>
    <?php } ?>

    Some html and php in between…

    <?php if ( is_home() || is_archive() || is_404() ) { ?>
    	<div id="dsfsdf">
    		<script type="text/javascript"><!--
    			google_ad_client = "pub-006913815847188";
    			/* 300x250, created 6-2-09 (o) */
    			google_ad_slot = "6514371817";
    			google_ad_width = 300;
    			google_ad_height = 250;
    			//-->
    			</script>
    			<script type="text/javascript"
    			src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
    		</script>
    	</div>
    	<?php } elseif ( is_single() ){ ?>
    	    something else
    	<?php } ?>

    Thread Starter knalstaaf

    (@knalstaaf)

    I see. However I’ve been using ‘or’ in other php circumstances with success.

    Anyway, I’ve changed this to || but with no result.

    Should I use echoes instead of hard html between <? ?>’s?

    Thread Starter knalstaaf

    (@knalstaaf)

    Found it:

    <?php
    	if (is_category(4)) {
    		the_content();
    	}else{
    		the_excerpt();
    	}
    ?>

    When the category’s ID is 4, the full posts will be displayed in the archive. Other posts will be displayed as a teaser.

    Thread Starter knalstaaf

    (@knalstaaf)

    Ok, got it working with the Cre8d tutorial after all. I misinterpreted the structure of the columns.

    Its not:

    <row>
    <col1><col2>
    <col1><col2>
    <col1><col2>
    </row>

    But:

    <row><col1><col2></row>
    <row><col1><col2></row>
    <row><col1><col2></row>
    Thread Starter knalstaaf

    (@knalstaaf)

    No idea?

    Forum: Fixing WordPress
    In reply to: can’t login!?

    You have tried this, did you?

    Forum: Plugins
    In reply to: WP Blog Stats Problem

    Have you got your Akismet API key and have you activated it? This is required for the stats to work.

    What if you did. Since you’re using a theme, make sure the line
    <?php wp_footer(); ?>
    appears in your footer. You can find this php-file in wp-content/themes/(themename)/footer.php. Open that file and copy paste the above line in it if it isn’t already there.

    Thread Starter knalstaaf

    (@knalstaaf)

    Exactly, I’ve consulted the documentation about this plug in again and true, that piece code is -meant- to display this box. I thought that code was required to track visits.

    My blogstats weren’t shwoing any visits, but I’ve found out that my footer wasn’t calling to <?php wp_footer(); ?> which is required for the Akismet stats.

    It’s working now. Thanks!

Viewing 15 replies - 1 through 15 (of 22 total)