Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • It didn’t work because you didn’t use The Loop!

    This code below should give you exactly what you want. And didn’t know a “get_a_post” plugin existed.

    You had a tiny error in the code with the forward/next links, you just switched them around. You will note however that they won’t show up on the main page. This is because theres only one post to always display there.

    <?php get_header(); ?>
    <?php if (is_home()) {query_posts('p=1');} ?>
    <?php if (is_home()){ $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("p=1&paged=$page");} ?>
    <div id="content">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     <div class="entry">
     <h2 class="etitle" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <?php the_content('Read the rest of this entry ?'); ?>
    </div>
    <p class="postmetadata"><?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments ?', '1 Comment ?', '% Comments ?'); ?>
    <?php comments_template(); // Get wp-comments.php template ?>
    </div>
    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    
    <?php endif; ?>
    <div class="navigation">
    <div class="alignleft"><?php previous_posts_link('? Previous Entries') ?></div>
    <div class="alignright"><?php next_posts_link('Next Entries ?') ?>
    </div>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    Thread Starter sanchit

    (@sanchit)

    I realized that I needed a get_the function cause they don’t echo but they just return the values. Once I got to see the actual functions for my own in the author-template.php file everything became clear as to how I could use everything.

    You’re making the same mistake as me! $user_ID==1 ??

    Thanks for the input. Problem is solved though. ??

    Thread Starter sanchit

    (@sanchit)

    <?php
    global $user_level; global $user_ID; get_currentuserinfo();
    //echo $user_ID;
    if ($user_ID==2 || $user_ID==7 || $user_ID==4 || $user_ID==5)
    {
    if (get_the_author_login()=="PersonsLoginName")
    { echo "<a>Ricky Martin</a>"; }
    else { the_author_posts_link();  }
    }
    else { the_author_posts_link();  }
    ?>

    I think this works fine.. the problem with the earlier code might have been the fact that in the $user_ID=watever it should be ==

    Anyways, enjoy.

    Thread Starter sanchit

    (@sanchit)

    well… no thanks to everyone here but I found the_author() function with the depreciated functions in wp-includes/author-template.php I am going to mess around it over there.

    I still don’t know why when I put in that code it only works for the first post by that author on a page.. :\

    Thread Starter sanchit

    (@sanchit)

    Can someone tell me where the_author and other function are written so that I can solve this on my own? Which file in which folder?

    Thanks.

    make a file that has <?php phpinfo(); ?> and save it as a .php file. then see if it shows something or the other. If it shows gibberish then you don’t have php working otherwise it’ll show something like this

    I still think you don’t have php working cause it shows <?php e_(‘Continue to the Second Step’) ?> which is impossible when you have php installed as php code can’t be seen client side.

    I don’t have one post on a page. But if you use query post then the silly forward / back links don’t work. I don’t think it’ll affect him since he only has one post but its there if he has that issue in the future if he changes his mind.

    I also included it because if he has a workaround to having pages include posts he’ll need that to make sure the next/back posts are working.

    This is my website and the comics section has a comic switcher thing setup with the comics being actual posts solely in the Comic category.

    Since I just have index.php handle all pages and the main page I needed that code to make everything functional.

    The only issue I have is that I want the latest day’s worth of posts in the front page (Front page already excludes all comic posts) AND the next/back thing to work to switch between days. But everyone always dodges that question in the support thread…

    I might need to do something crazy and maybe use the wp-calendar code and fiddle with it but if theres an easier way I’d rather do that first.

    I think my sites running on the bare minimum stuff.. index.php archive.php search.php comments.php… I don’t really get the difference between search.php and archive.php but thats not too much of an issue. So yeah… I’ve had to do a LOT of fiddling around these days to get the site working the way I want it.

    Thats if he doesn’t have a home.php like I don’t. Just making it specific and avoiding the problems that I ran into.
    I am running 2.2 and am using my code on my site! ??

    Dunno why but for it to recognize themes keep the default theme that comes with WordPress and then you can add any other theme. If you remove the default folder all gets lost. I think its based on the fact that if the theme doesn’t exist or is bad, it has something to fall back on.

    Someone else will be able to clarify why exactly all this happens but thats my reasoning.

    https://www.ads-software.com/support/topic/87020?replies=4#post-444035
    https://www.ads-software.com/support/topic/38210

    <?php
    if (is_home()){
    $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    query_posts(“cat=12&paged=$page”);
    }
    ?>

    This will only display posts from category 12. Change the number in query posts to your category. And put this code in your index.php or whatever file.

    Soo many people are going through the same issues I had a week ago.. :\

    <?php echo '<a href="' .get_month_link($thisyear, $thismonth) . '"> ' . $wp_locale->get_month($thismonth) . ' ' . "This Month" . ' </a>' ?>

    This line will give you the current month’s archive page. You aldready have that calendar installed. Its called in the sidebar if you put in these lines:

    <h2><?php _e('Calendar'); ?></h2>
    <?php get_calendar(); ?>

    I modified the wp-includes/general-template.php because the calendar already had the functionality to switch months so all I had to do was change the code a bit to make the month a link.

    You probably want

    <?php if (is_home()) {query_posts(‘p=1’);} ?>

    so that it only effects the main page If you do just what tsguitar said then I believe affects a bunch of pages (depending).

    And to get the next/previous doesn’t show up in other pages and work, You might have to do something like

    if (is_home()){ $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; query_posts(“p=1&paged=$page”);
    }

    Thats all from fiddling with the code and looking around for about a week, it works for me.

    I had actually modified the calendar thing in the sidebar to achieve this functionality.

    This is what I did to the general-template.php file. Just search for thead and you’ll get there.

    <thead>
    	<tr><td align="center" colspan="7"><a href="' .get_month_link($thisyear, $thismonth) . '"> ' . $wp_locale->get_month($thismonth) . ' ' . date('Y', $unixmonth) . ' </a></td></tr>
            <tr>';

    Bump. I want posts on a given day but I also want a forward / back button on the bottom. How will I do that?
    Thanks.

    Here is the index.php I really don’t know how to fix this with the wp_query stuff which I don’t fully understand. Sorry about the messy file but thats how I got the pages to work…

    <?php
    /* Template Name: Main Index
    */
    ?>
    <?php
    get_header();
    ?>
    
    <?php
    if (is_home()) {
    $latest = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
    $latest = str_replace('-', '', substr($latest, 0, 10));
    //echo $latest;
    query_posts('m=' . $latest . '&showposts=-1');
    $wp_query->is_archive = false; $wp_query->is_home = true;
    } else { $post = $wp_query->post; }?>
    
    <?php if (in_category('12') && is_home()==false) { ?>
    <div id="comic">
    <?php } else { ?>
    <div id="content">
    <?php } ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php if (in_category('12') && is_home()==false) { ?>
      <div class="entry_comic">
    <h3 class="etitle" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark">
          <?php the_title(); ?>
          </a> </h3>
    <div align="center">
    <a href="https://66.7.201.40/~cujpybvo/comic/2007/07/11/sanchit-is-always-messin-with-mimes/"><img src="<?php echo bloginfo('template_directory');?>/images/first.gif" border="0"></a>
    <?php
    $wp_query->is_single = true;
    previous_cat_post($beforeGroup='', $afterGroup='', $beforeEach='', $afterEach='', $showtitle=false, $textForEach='<img src="../../../../../wp-content/themes/mushblue-10/images/back.gif" border="0">');
    $wp_query->is_single = false;
    ?>
    &nbsp;<a href="<?php echo bloginfo('url');?>/"><img src="<?php echo bloginfo('template_directory');?>/images/home.gif" border="0"></a>
    <?php
    $wp_query->is_single = true;
    next_cat_post($beforeGroup='', $afterGroup='', $beforeEach='', $afterEach='', $showtitle=false, $textForEach='<img src="../../../../../wp-content/themes/mushblue-10/images/next.gif" border="0">');
    $wp_query->is_single = false;
    ?>
    &nbsp;<a href="https://66.7.201.40/~cujpybvo/comic/"><img src="<?php echo bloginfo('template_directory');?>/images/new.gif" border="0"></a>
    </div>
    <?php } else { ?>
      <div class="entry">
    <div class="date"><p><span class="month"><?php the_time('M') ?></span><span class="day"> <?php the_time('j') ?> </span></p></div>
    <h3 class="etitle" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark">
          <?php the_title(); ?>
          </a> </h3>
             <div class="emeta">
                  Posted by:&nbsp;<?php the_author_posts_link(); ?><br>
                  <?php //the_time('F dS, Y');
                        echo "  Category: "; the_category(',');
                  ?>
              </div>
    
    <?php } ?>
    
        <div class="ebody">
    <?php if (!empty($post->post_excerpt) && is_home()) { the_excerpt(); } else {the_content(__('Read more')); }?>
    <?php if (in_category('12')) { ?>
    <?php edit_post_link(__('<strong>Edit</strong>'));?>
    <?php } else { ?>
       <?php comments_popup_link( 'No comments ','1 comment ','% comments ','clink ',''); edit_post_link(__('<strong>Edit</strong>'));?>
    <?php } ?>
        </div>
        <!-- <?php trackback_rdf(); ?> -->
    <?php if (!in_category('12')) { ?>
      <?php comments_template(); // Get wp-comments.php template ?>
    <?php } ?>
      </div>
      <?php endwhile; else: ?>
      <p>
        <?php _e('Sorry, no posts matched your criteria.'); ?>
      </p>
      <?php endif; ?>
    <?php if (in_category('12') && is_home()==false) { ?>
    <div align="center">
    <a href="https://66.7.201.40/~cujpybvo/comic/2007/07/11/sanchit-is-always-messin-with-mimes/"><img src="<?php echo bloginfo('template_directory');?>/images/first.gif" border="0"></a>
    <?php
    $wp_query->is_single = true;
    previous_cat_post($beforeGroup='', $afterGroup='', $beforeEach='', $afterEach='', $showtitle=false, $textForEach='<img src="../../../../../wp-content/themes/mushblue-10/images/back.gif" border="0">');
    $wp_query->is_single = false;
    ?>
    &nbsp;<a href="<?php echo bloginfo('url');?>/"><img src="<?php echo bloginfo('template_directory');?>/images/home.gif" border="0"></a>
    <?php
    $wp_query->is_single = true;
    next_cat_post($beforeGroup='', $afterGroup='', $beforeEach='', $afterEach='', $showtitle=false, $textForEach='<img src="../../../../../wp-content/themes/mushblue-10/images/next.gif" border="0">');
    $wp_query->is_single = false;
    ?>
    &nbsp;<a href="https://66.7.201.40/~cujpybvo/comic/"><img src="<?php echo bloginfo('template_directory');?>/images/new.gif" border="0"></a>
    </div>
    </div>
    <?php } else { ?>
      <p>
        <?php posts_nav_link(' — ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
      </p>
      </div>
    
    <?php get_sidebar(); ?>
    <?php } ?>
    <!-- The main column ends  -->
    <?php get_footer(); ?>

    I don’t think you have php on that server you’re on… or you messed up the install.php file somehow..

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