Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Forum: Plugins
    In reply to: Query_post week days?
    Thread Starter headphonesilence

    (@headphonesilence)

    Thanks I’ll take a look at it ??

    Forum: Plugins
    In reply to: Query_post week days?
    Thread Starter headphonesilence

    (@headphonesilence)

    By upcoming I mean I use post as events. I make the post visible by publishing it on the future date and displaying only upcoming posts in my index.

    So when I click on “monday” it should display only posts from the upcoming monday.
    What exactly do you suggest?

    I have looked on the website you suggested. This for example would display only posts for the upcoming week, I guess:

    <?php wp_get_archives(‘type=weekly&limit=1’); ?>

    I guess I am to replace “weekly” with a week day like “monday”. Would that even work?

    Thread Starter headphonesilence

    (@headphonesilence)

    Yes the custom field will be displayed – that’s not the problem.

    As you might have noticed I use the code below.

    <?php if (have_posts()) : ?>
    <?php
    //based on Austin Matzko’s code from wp-hackers email list
    function filter_where($where = ”) {
    //posts in the coming days
    $where .= ” AND post_date > ‘” . date(‘Y-m-d’, strtotime(‘+0 days’)) .”‘”;
    return $where;
    }
    add_filter(‘posts_where’, ‘filter_where’);
    query_posts($query_string . “&order=ASC”);
    ?>

    When using the code you have to publish the post on the day the event ends – for else the post will not be showed, when the current date is over.

    For example if I publish a post about an art exhibition, I choose to publish the post two weeks ago – because the exhibition runs for two weeks – for example on May 15th. And the post will be displayed on the website, as long as I post it today or some date in the future (+0 days like the code says). BUT the problem is that people might not notice that the art exhibition runs before they scroll down to May 15th and then it’s too late for them to go to the art exhibition.

    So what I need is an extra feature that will display the post during the period it is active. If I publish a post in june and the event is also active in may and june, the post will only be displayed if you click on the month of june on my website.

    I would be nice to have a feature that makes you choose when a post starts and when a posts end. The custom fields are not interacting with the actually publish date. It only shows some fields.

    I hope you know what I mean?

    Thread Starter headphonesilence

    (@headphonesilence)

    Thank you – but I am not exactly sure how to use it.

    Here is my index.php.
    Where do I paste the code and and am I supposed to make new custom fields to make it work?

    I’m not that good at coding, sorry ??

    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
    <html xmlns=”https://www.w3.org/1999/xhtml&#8221; xml:lang=”EN” lang=”EN”>

    <?php get_header(); ?>

    <body>
    <div class=”main”>
    <div class=”container”>
    <div class=”span-24 header”>
    <h1 class=”name”>“><?php bloginfo(‘name’); ?><!–<span class=”bubble”><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/img/<?php echo $bubbles; ?>” alt=”bubbles” /></span>–></h1>
    <span class=”slogan”><?php bloginfo(‘description’); ?></span>
    </div>

    <?php include (TEMPLATEPATH . “/navigation.php”); ?>

    <div class=”span-24 content”>

    <div class=”span-16 post-wrapper”>

    <?php if (is_category(28)) { ?>
    <h1>Art</h1>
    <?php } else { ?>
    <h1>Cal</h1>
    <?php } ?>

    <?php
    if (is_home()) {
    query_posts(“cat=-28”);
    }
    ?>

      <?php if (have_posts()) : ?>
      <?php
      //based on Austin Matzko’s code from wp-hackers email list
      function filter_where($where = ”) {
      //posts in the coming days
      $where .= ” AND post_date > ‘” . date(‘Y-m-d’, strtotime(‘+0 days’)) .”‘”;
      return $where;
      }
      add_filter(‘posts_where’, ‘filter_where’);
      query_posts($query_string . “&order=ASC”);
      ?>

      <?php while (have_posts()) : the_post(); ?>

      <li class=”post”>
      <div class=”text-header”>
      <div class=”hr”><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/img/<?php echo $scissors; ?>” alt=”scissors” /></div>

      <h2 class=”title”> ” title=”Permanent Link to <?php the_title_attribute(); ?>”> <?php the_time(‘d M //’) ?> <?php the_title(); ?> </h2>
      <span class=”no”> ” title=”Permanent Link to <?php the_title_attribute(); ?>”> <?php comments_number(‘Skriv en kommentar’, ‘1 kommentar’, ‘% kommentarer’); ?></span>
      <div class=”clear”></div>

      </div>

      <div class=”info-small”>
      <span class=”author”> Skrevet af:
      <?php the_author_posts_link(); ?></p></span><span class=”cat”>
      <?php the_category(‘, ‘) ?></span>
      </div>

      <?php the_content(‘L?s mere.. »’); ?>
      <?php echo ‘<ul class=”addtoany_list”>’;
      if( function_exists(‘ADDTOANY_SHARE_SAVE_ICONS’) )
      ADDTOANY_SHARE_SAVE_ICONS( array(“html_wrap_open” => ”

    • “, “html_wrap_close” => “
    • “) );
      if( function_exists(‘ADDTOANY_SHARE_SAVE_BUTTON’) )
      ADDTOANY_SHARE_SAVE_BUTTON( array(“html_wrap_open” => ”

    • “, “html_wrap_close” => “
    • “) );
      echo ‘

    ‘; ?>

    <?php the_meta(); ?>
    <div class=”clear”></div>
    <?php the_tags(‘<span class=”tag small”> Tags: ‘, ‘, ‘, ‘</span>’); ?>
    <?php edit_post_link(‘Edit’, ‘<p class=”edit”>’, ‘</p>’); ?>

    <?php endwhile; ?>
    <?php else : ?>

    • <p><h2>Ikke fundet indl?g</h2></p>
      <p>Der er endnu ikke skrevet indl?g for denne m?ned.</p>
    • <?php endif; ?>
      <li class=”post”>
      <p class=”alignright calendar-forward”><?php next_posts_link(‘» Se l?ngere frem i kalenderen’) ?></p>
      <p class=”alignleft calendar-back”><?php previous_posts_link(‘« G? tilbage’) ?></p>

      </div>
      <div class=”span-8 last sidebar”>
      <?php get_sidebar(); ?>
      </div>
      </div>

      <?php get_footer(); ?>
      </div>
      </div>

      </body>
      </html>

Viewing 4 replies - 1 through 4 (of 4 total)