Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:52:06+00:00 2026-06-13T08:52:06+00:00

I have a PHP while loop as follow: <?php while (have_posts()) : the_post(); ?>

  • 0

I have a PHP while loop as follow:

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

<li> 
<?php
    $args = array(
      'post_type' => 'attachment',
      'numberposts' => -1,
      'post_status' => null,
      'post_parent' => $post->ID,
      'orderby' => 'menu_order',
      'order' => 'ASC'
    ); 

    $attachments = get_posts($args);

    if ($attachments) {
      foreach ( $attachments as $attachment ) {
        $image_attributes = wp_get_attachment_image_src( $attachment->ID, large );
        $alt_text_title = $attachment->post_title ;
        //print_r($attachment); 

        echo "<img src=\"$image_attributes[0]\" alt=\"$alt_text_title\">";
        }
    }
?>
<h3><a href="http://<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_content(); ?>
</li>
<?php endwhile;?> 

The a tag inside the h3 makes all the titles hyperlinks however I would like one of these title not be a link therefore not to be affected by the a tag at all..

Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:52:07+00:00Added an answer on June 13, 2026 at 8:52 am

    Edit. A safer way it to do it via post ID.

    <?php $postID = $post->ID;
    
    echo $postID; 
    // You could delete this line once you have the PostID. 
    
    if($postID == '1') { ?>
      <h3><?the_title();?></h3>
    <?php } else { ?>
      <h3><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?the_title();?></a></h3>
    <?php } ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Wordpress loop as follows: <?php $loop = new WP_Query( array( 'post_type'
<?php $i = 1; $y = 5; ?> <?php while (have_posts()) : the_post(); ?>
I have this PHP in a while loop: echo <td><a href='#' class='po'> . $row['order_no']
I have a simple PHP while loop which executes a list of tabular comments/posts
I have a PHP MySQL fetch while loop as shown below in my script:
I have a while loop in php that fetches results of a query (a
i have php while loop, creates many classes, displaying info (user posts ect) and
I have a PHP while loop that generates a table containing input tags. Each
I have a page where I am using a PHP while loop to echo
I have PHP script works without problems, like this : while($row4 = mysql_fetch_array($result4)) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.