WordPress.org

Ready to get started?Download WordPress

Forums

Php problem (2 posts)

  1. theufw
    Member
    Posted 12 months ago #

    Hi all,

    I'm using Exec-php plugin and trying to set up listing on a page. Well, I don't really know about php.. so I got some problems that I can't fix. Please help me.

    1. I want to tile 3 posts each line but at the moment they're length-ways.
    2. When I click on "READ MORE", it will take me to 404 error page..

    How do I fix these problems?

    Thanks in advance!

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php
    global $post;
    $tmp_post = $post;
    $category_ids = array( '6' );
    $numberposts = '6';
    foreach ( $category_ids as $category_id ) {
    ?>
    <h3><?php echo get_cat_name( $category_id ); ?></h3>
    
    <ul>
      <?php
         $postslist = get_posts( "category=$category_id&numberposts=$numberposts&order=DESC&orderby=date" );
         foreach ( $postslist as $post ) {
    ?>
    
    <li> <a href="<?php">ID ); ?>></a><?php echo $post->post_title; ?></li>
    <span style=" clear: both; margin-right: 1em;"><a href="http://mysite.com"><?php the_post_thumbnail(array(180,180), array('class' => 'left')); ?></a></span>
      <?php
         }
    ?>
    </ul>
    <?php echo mb_substr(strip_tags($post-> post_content), 0, 50); ?>
    <a href="”<?php">” class=”more-link”>...READ MORE</a>
    <?php
     }
     $post = $tmp_post;
     ?>
  2. theufw
    Member
    Posted 12 months ago #

    <?php
    global $post;
    $tmp_post = $post;
    $category_ids = array( '6' );
    $numberposts = '6';
    foreach ( $category_ids as $category_id ) {
    ?>
    <h3><?php echo get_cat_name( $category_id ); ?></h3>
    
    <ul>
      <?php
         $postslist = get_posts( "category=$category_id&numberposts=$numberposts&order=DESC&orderby=date" );
         foreach ( $postslist as $post ) {
    ?>
    
    <li> <a href="<?php">ID ); ?>></a><?php echo $post->post_title; ?></li>
    <span style=" clear: both; margin-right: 1em;"><a href="http://mysite.com"><?php the_post_thumbnail(array(180,180), array('class' => 'left')); ?></a></span>
      <?php
         }
    ?>
    </ul>
    <?php echo mb_substr(strip_tags($post-> post_content), 0, 50); ?>
    <a href="”<?php">” class=”more-link”>...READ MORE</a>
    <?php
     }
     $post = $tmp_post;
     ?>

Reply

You must log in to post.

About this Topic

Tags