Jump to content

dangermoose

New Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

dangermoose's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I've been struggling to get an if statement to work. I'm new to PHP so bear with me! I have an events listing page where I pull a value from a custom field to display a 'buy tickets' button. I can get the button to display and it works well but what I need to do is customise the code so if there is no ID present, then a piece of text displays. Any pointers appreciated. This is one method Im using for custom fields which works well - the if statement works here also. <div> <p><strong>Location:</strong> <?php $event_location = get_post_meta($post->ID, 'Event_Location', true); if ($event_location) { ?> <?php echo $event_location; ?> <?php } else { ?> <p>No Location Available.</p> <?php } ?> </p> </div> This code pulls in the buy tickets button but I cant figure out how to create an if statement with it! grrrr... <div> <p> <?php $values = get_post_custom_values('Product_ID'); echo get_button_code_for_product($values[0]); ?> </p> </div> I would like it to look for the ID and if it can't find it then displays ' No Product ID' or some such text.
  2. I've kind of got it working now. It display's the list in the correct order but the functionality of the 'next' and 'previous' buttons at the bottom of the page is broken, it basically loads the same posts again when clicking 'next'... This is the line of code that i edited: query_posts('cat=$portfoliopages.&paged=&showposts=20&category_name=festival&meta_key=Date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); I think there may be a conflict between 'cat=$portfoliopages' & the code I added in that line but not sure how to fix. Any ideas?
  3. Hi all, Im new to php but enjoying the learning curve and also getting to know my way around WordPress. I am building a page to list events and came across a great tutorial http://www.problogdesign.com/wordpress/how-to-make-a-wordpress-events-list. I cannot manage to get it to work with my themes php though, it kind of works and does list the events but doesnt pull in the images assigned to each event (post). I also lost the 'next' and 'previous' buttons at the bottom of the page for some reason. I thoguth it had something to do with the <?php if (have_posts()) : while (have_posts()) : the_post(); ?> , maybe was in the wrong place but not so sure. Is there anything very obvious (Im sure there is!) I'm missing bearing in mind all I have added is the code from that url... <?php the_content(); ?> </div> </div> <?php //not sure about this? It was originally - while (have_posts()) : the_post(); if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="grid_4a alpha portfolio-box-events"> <div class="gallery clearfix" style="width:220px;"><br/> <?php $img=get_post_meta($post->ID, 'Image', true); $timthumboption = get_option("timthumboption"); ?> <?php if($img) { ?> <?php if( $timthumboption == "0" ){?> <a href="<?php echo $img; ?>" rel="prettyPhoto[gallery2]"> <img src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $img; ?> &w=204&h=104&zc=2" alt="<?php the_title(); ?>" class="thumbnail-border"/> </a> <?php } ?> <div style="position:relative; float:left; width:700px;"> <div style="width:204px; position:relative; float:left;"> <?php if( $timthumboption == "1" ){?> <a href="<?php echo $img; ?>" rel="prettyPhoto[gallery2]"><img src="<?php echo $img; ?>" width="204" alt="<?php the_title(); ?>" class="thumbnail-border"/></a> <?php } }?> </div> <?php // Get today's date in the right format $todaysDate = date('m/d/Y H:i:s');?> <?php query_posts('showposts=10&category_name=festival&meta_key=Date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); ?> <div style="width:450px; position:relative; float:left; margin-left:20px;"> <h3><a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h3> <p> <?php the_content(); ?> </p> <a href="<?php the_permalink() ?>" class="view-more2"><strong>View More</strong></a> <?php endwhile; else: ?> Sorry, no upcoming events! <?php endif; ?> <?php wp_reset_query(); ?> </div> </div> </div> </div> </div> <?php endwhile; ?> <div class="clear"> </div> <div class="navigation"> <div class="alignright"> <?php next_posts_link('Next Page »') ?> </div> <div class="alignleft"> <?php previous_posts_link('« Previous Page') ?> </div> </div> </div> <!--End Right Section --> </div> </div> </div> <!--End middle content Section --> <?php get_footer(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.