go41

no double posting!

von Joern am 11. Apr. 2011 | Keine Kommentare

hey still working and editing my arthemia theme and there is a small fix that has really been bugging me but I want it fixed. I would like the posts that show up in my headline/featured to not show up in my spoiler posts that are on the front page. If you can help me with a simple fix or if you can help me clean up this coding as I have done a lot of editing to the theme with various different bits and pieces of coding!!Code:

this is the code to myslider (i think i found this code on your forum)
<div id="myslider" >

   <ul class="ui-tabs-nav">

      <?php query_posts('showposts=4'); $i = 1; if (have_posts()) { while (have_posts()) { the_post(); ?>

         <li class="ui-tabs-nav-item <?php if ($i == 1) { ?>ui-tabs-selected<?php } ?>"<?php echo 'id="nav-fragment-' . $i . '">'; ?>

         <?php $values = get_post_custom_values("Image"); if (isset($values[0])) { ?>

         <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=80" alt="" />

         <?php }

else {

$id =$post->ID;

$the_content = $post->post_content;

$home = get_option('home');

$pattern = '!<img.*?src="'.$home.'(.*?)"!';

preg_match_all($pattern, $the_content, $matches);

$image_src = $matches['1'][0];

if($image_src != '') {?>

<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php echo $image_src; ?>&w=100&h=65&zc=1&q=80" alt="" />

<?php  }

else {?>

<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/wp-content/themes/arthemia/images/default.png&w=100&h=65&zc=1&q=80" alt="" /><?php

} }?>
         <span><?php the_title(); ?></span>

         <?php  $i++; } // end while loop

         } // end if

      wp_reset_query(); ?>
   <?php query_posts('showposts=4'); $i = 1; if (have_posts()) { while (have_posts()) { the_post(); ?>

      <?php echo '<div id="fragment-' . $i . '" class="ui-tabs-panel" style="">'; ?>

         <?php $values = get_post_custom_values("Image"); if (isset($values[0])) { ?>

            " ><img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>&w=610&h=310&zc=1&q=80" alt="" width="610" height="310"/>

         <?php }

else {

$id =$post->ID;

$the_content = $post->post_content;

$home = get_option('home');

$pattern = '!<img.*?src="'.$home.'(.*?)"!';

preg_match_all($pattern, $the_content, $matches);

$image_src = $matches['1'][0];

if($image_src != '') {?>

<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php echo $image_src; ?>&w=610&h=310&zc=1&q=100" alt="" width="610" height="310"/>

<?php  }

else {?>

<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/wp-content/themes/arthemia/images/default.png&w=610&h=310&zc=1&q=80" alt="" width="610" height="310"/><?php

}}?>

      <div class="info" >

            <h2>" ><?php the_title(); ?></h2>

            <p><?php the_content_rss('', TRUE, '', 20);  ?>" >read more</p>

         </div>

      </div>

      <?php  $i++; } // end while loop

      } // end if

   wp_reset_query(); ?>

</div>

Code:


and this is the coding that is on my index.php
<!--- code to display one post per category only, put the category ID below in the order you wish and as many you want --->

<?php $display_categories = array(4,8,3,9,10); foreach ($display_categories as $frontcats) { ?>

<?php $catposts = get_posts("showposts=1&cat=$frontcats"); foreach($catposts as $post) : setup_postdata($post); ?>

<div class="clearfloat">

<h3 class=cat_title>"><?php $this_category = get_category($frontcats); ?><?php echo $this_category->cat_name; ?> »</h3>

<div class="title">" rel="bookmark"><?php the_title(); ?></div>

<div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>

<div class="spoiler">

<?php   $values = get_post_custom_values("Image");if (isset($values[0])) { ?>

" 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=150&h=150&zc=1&q=100"

alt="<?php the_title(); ?>" class="left" width="150px" height="150px"  />

<?php }

else {

 $id =$post->ID;

$the_content = $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $id");

$home = get_option('home');

$pattern = '!<img.*?src="'.$home.'(.*?)"!';

preg_match_all($pattern, $the_content, $matches);

$image_src = $matches['1'][0];?>

<?php if($image_src != '') { ?>" rel="bookmark" title="<?php echo $title; ?>"><img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $image_src; ?>&w=150&h=150&zc=1&q=100"

alt="<?php the_title(); ?>" class="left" width="150px" height="150px"  />

<?php }

else { ?>

" rel="bookmark" title="<?php echo $title; ?>"><img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/wp-content/themes/arthemia/images/header.png&w=150&h=150&zc=1q=100"

alt="<?php echo $title; ?>" class="left" width="150px" height="150px" /> <?php } ?>

<?php  } ?>

<?php the_excerpt(); ?>" alt="Read More">[ Read More ]

</div>

</div>

<?php endforeach;  // end of post ?>

<?php }  ?>

<!--- end of code to display one post per category only --->

<?php } // end of FIRST PAGE ?>
<?php if(is_paged()) { // start of IF IS PAGED ?>
   <div id="bottom" class="clearfloat">
   <div id="front-list">   
   <?php

      $page = (get_query_var('paged')) ? get_query_var('paged') : 1;

      query_posts("cat=-27,-28&paged=$page&posts_per_page=5"); ?>

   <?php $postno = 1; ?>

   <?php while (have_posts()) : the_post(); ?>      
   <div class="clearfloat">

   <h3 class=cat_title><?php the_category(', '); ?> &raquo</h3>

   <div class="title">" rel="bookmark"><?php the_title(); ?></div>

   <div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>   
   <div class="spoiler">

   <?php   $values = get_post_custom_values("Image");

   if (isset($values[0])) { ?>

      " 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=150&h=150&zc=1&q=100"

alt="<?php the_title(); ?>" class="left" width="150px" height="150px"  />

      <?php } ?>
   <?php the_excerpt(); ?>

   </div>
   </div>
<?php if ($postno == 1) { ?><div align="center" style="margin-bottom: 10px;">

AdSense Code below post No. one replace with your code or delete this line

</div><?php  } ?>

<?php if ($postno == 3) { ?><div align="center" style="margin-bottom: 10px;">

AdSense Code below post No. three replace with your code or delete this line

</div><?php  } ?>

<?php $postno++; ?>   
      <?php endwhile; ?>
<?php } // this is the end of IF IS PAGED ?>
   <div class="navigation">
   </div>
   </div>

(von: msderky)

Hier noch 1 weitere Ergebnisse dieses Threads:

Re: no double posting! :: Reply by Joern

14. Apr. 2011 (von: Joern)

Actually Arthemia has this function built in already. In your index.php under the div id="front-list" you have:Code:<?php$page = (get_query_var('paged')) ? get_query_var('paged') : 1;query_posts("cat=-27,-28&paged=$page&posts_per_page=5"); ?>The part cat=-27,-28 means posts from the two categories with the ID 27 and ID 28 will…

Autor:

Du findest mich auch auf Google+, Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


weitere forum Beiträge: