• Plans & Pricing
  • Log in
  • Get started
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress 
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Get started
  • Sign up
  • Log in
About
  • Plans & Pricing
Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress  
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Jetpack App
  • Learn more
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Search
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Forums / Help with tags, please

Help with tags, please

  • Unknown's avatar
    sergiozambrano · Member · Mar 23, 2009 at 12:05 am
    • Copy link Copy link
    • Add topic to favorites Add topic to favorites

    I’m the webmaster of http://www.seosumo.com and we hired some russian guys who made our pages.php to show posts along with the page. They didn’t use recommended WP loop coding but custom, so now I don’t know how to fix the mess (I’m not a php programmer)

    Can anyone help me out with this? You ca se the result at http://seosumo.com/who-we-are

    The problem is in line 67 (post_tag). Only thing I can say it’s not right.

    _______________________________________________________________

    <?php
    /*
    Template Name: Pages
    */
    ?>
    
    <?php get_header();
    
    // **************************************************************
    // MOD
    // ************************************* ; get list of last posts
    
    class cst_mod_last_posts {
        var $cst_host;
        var $cst_db;
        var $cst_user;
        var $cst_pw;
    
        var $aPosts;
    
        //------ get array with posts
        function get_posts() {
            //------- get info
            $cst_host = DB_HOST;
            $cst_db = DB_NAME;
            $cst_user = DB_USER;
            $cst_pw = DB_PASSWORD;
    
            // $iCID = mysql_connect( $this->cst_host, $this->cst_user, $this->cst_pw );
            // $bSelDB = mysql_select_db( $this->cst_db, $iCID );
    
            $sSQL = " SELECT wp_posts. * , wp_term_taxonomy.term_id FROM wp_posts INNER JOIN wp_term_relationships ON ( wp_posts.ID = wp_term_relationships.object_id ) INNER JOIN wp_term_taxonomy ON ( wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id ) WHERE 1 =1 AND wp_term_taxonomy.taxonomy = 'category' AND wp_posts.post_type = 'post' AND ( wp_posts.post_status = 'publish' ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC, term_id ";
    
            $iRID = mysql_query( $sSQL );
    
            //--------- set values
            $iCatIDCheck = -1;
            $this->aPosts = array();
    
            //--------- get reads
            if ( $iRID ) {
                while ( $aData = mysql_fetch_array( $iRID )) {
                    $iCatId = $aData['term_id'];
    
                    //---- if new cat - use new cat as current; add item to data
                    if ( $iCatId != $iCatIDCheck ) {
                        $this->aPosts[] = $aData;
                        $iCatIDCheck = $iCatId;
                    }
                }
            }
        }//------------------------ 
    
        //---- display post
        function display_posts() {
            foreach ( $this->aPosts as $key => $aItem ) {
                echo '<div class="entry multipost"
     id="post-' . $aItem['ID'] . '">
    
    <span class="postinfo">' . $aItem['post_date'] . '</span>
    <div class="postheader">
        <span class="postinfo"></span>
        <h1 class="typeface-js"><a href="/?p=' . $aItem['ID']  . '" rel="bookmark">' . $aItem['post_title'] . '</a></h1>
        <span class="postinfo">Filed under: <a href="/?cat=' . $aItem['term_id'] . '" title="View all posts in category" rel="category">category</a> </span>
    </div>
        ' . $aItem['post_content'] . ' <div class="postfooter postinfo">Tags: ' . the_terms( $aItem['ID'], 'post_tag', __('Tags: '), ', ', ' — ' ) . ' </div>
    
        <!-- end Entry --></div>';
    
            }
        }
    
    };  //------------------------ end of class
    
    //------- begin code
    
    $cst_cLastPosts = new cst_mod_last_posts();
    
    $cst_cLastPosts->get_posts();
    
    // MOD end *************************************
    
    ?>
    
    <div id="mainContent" class="showtab1">
      <div id="maincontent1">
          <h2 class="maintabs">
            <big><b>Sumo</b></big>
            <small><a href="javascript:void(0);" onclick="switch_main(2)">Latest Articles</a></small>
            <small><a href="javascript:void(0);" onclick="switch_main(3)">SEO Tools</a></small>
            </h2>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="entry" id="post-<?php the_ID(); ?>">
    
    <h1 class="typeface-js"><?php the_title(); ?></h1>
    	<?php the_content(__('(more...)')); ?>
    
    <?php endwhile; else: ?>
    	<div class="entry">
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
    <!-- end #entry --></div>
    
          <div class="footer"><hr /></div>
      </div>
    
    <div id="maincontent2">
          <h2 class="maintabs">
            <small><a href="javascript:void(0);" onclick="switch_main(1)">Sumo</a></small>
            <big><b>Latest Articles</b></big>
            <small><a href="javascript:void(0);" onclick="switch_main(3)">SEO Tools</a></small>
            </h2>
    
         <?php
         // MOD
         $cst_cLastPosts->display_posts();
         // MOD end
         ?>
    
        <!-- maincontent2 --></div>
    
    <div id="maincontent3">
          <h2 class="maintabs">
            <small><a href="javascript:void(0);" onclick="switch_main(1)">Sumo</a></small>
            <small><a href="javascript:void(0);" onclick="switch_main(2)">Latest Articles</a></small>
            <big><b>SEO Tools</b></big>
            </h2>
    
      <div class="entry">
          <h1>SEO Tools</h1>
          <p>This page is under construction and it will be up soon.</p>
        <!-- end Content 3 --></div>
          <div class="footer"><hr /></div>
     <!-- end Content3 --></div>
    
     <!-- end mainContent --> </div>
    
    <?php include(TEMPLATEPATH.'/sidebars.php'); ?>
    
    <br class="clearfloat" />
    <!-- end #maincontainer --></div>
    
    <?php get_footer(); ?>

    ________________________________________________________________________

  • Unknown's avatar
    ellaella · Member · Mar 23, 2009 at 12:08 am
    • Copy link Copy link

    Hi, there. You’re in the wrong place and need to be at wordpress.org for help with that.

    https://en.forums.wordpress.com/topic/please-read-me-first-before-posting?replies=1

  • Unknown's avatar
    sergiozambrano · Member · Mar 23, 2009 at 12:09 am
    • Copy link Copy link

    Sorry, I forgot to mention: Posts appear on second tab named “Articles” and the tags appear at the top, outside and before the expected div.

  • Unknown's avatar
    thesacredpath · Member · Mar 23, 2009 at 12:14 am
    • Copy link Copy link

    Please read ella’s reply. You are in the wrong forum. Self-hosted blogs are supported over at http://worpdress.ORG/support/ .

  • Unknown's avatar
    ellaella · Member · Mar 23, 2009 at 12:15 am
    • Copy link Copy link

    We posted almost at the same time. Please see my reply above.

  • The topic ‘Help with tags, please’ is closed to new replies.

Tags

  • custom php
  • post_tag
  • the_loop
  • the_post
  • wp functions

About this topic

  • In: Support
  • 3 participants
  • 4 replies
  • Last activity 17 years
  • Latest reply from sergiozambrano

Couldn't find what you needed?

Contact us

Contact us

Get answers from our AI assistant, with access to 24/7 expert human support on paid plans.

Browse our guides

Browse our guides

Find step-by-step solutions to common questions in our comprehensive guides.

WordPress.com

Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Professional Email
  • Website Design Services
  • WordPress Studio
  • Enterprise WordPress
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • WordPress.com Blog
  • Business Name Generator
  • Logo Maker
  • WordPress.com Reader
  • Accessibility
  • Remove Subscriptions
Help
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
  • Developer Resources
Company
  • About
  • Press
  • Terms of Service
  • Privacy Policy
  • Do Not Sell or Share My Personal Information
  • Privacy Notice for California Users
DeutschEspañolFrançaisBahasa IndonesiaItalianoNederlandsPortuguês do BrasilSvenskaTürkçeРусскийالعربيةעִבְרִית日本語한국어简体中文繁體中文English

Mobile Apps

  • Download on the App Store
  • Get it on Google Play

Social Media

  • WordPress.com on Facebook
  • WordPress.com on X (Twitter)
  • WordPress.com on Instagram
  • WordPress.com on YouTube

Automattic

Automattic
Work With Us
    • WordPress.com Forums
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • Manage subscriptions