Support » Fixing WordPress » Single post with page title?

  • Sorry if this was posted as I’m new here, not sure what keywords to search for this particular topic.

    You see, I created a page call “News” and on this page, I’ve manually entered php code to grab post like so:

    global $more;
    // Only grab post from category 1
    query_posts( array( 'category__and' => array(1), 'posts_per_page' => 5, 'orderby' => 'title', 'order' => 'DESC' ) );
    
    // The Loop
    while (have_posts()) : the_post();
        $more = 0;
        echo '<div class="post">';
    
        echo '<div class="postTitle"><h4 class="posts_title"><a href="' . get_permalink() . '">';
        the_title();
        echo '</a></h4></div>';
    
        echo '<div class="entry postEntry">';
        the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'business' ) );
        echo '</div>';
    
        wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number'));
        echo '</div>';
    endwhile;
    
    // Reset Query
    wp_reset_query();

    The above is all working fine but when I clicked on a post title, the URL is http://localhost/the-post-title. How do I make it such that the URL is http://localhost/news/the-post-title?

    Additionally, the single post page itself I would like to also be able to grab the “News” title of the page so as if a person is viewing a single post, the “News” title is still showing on the page?

    Appreciate any help here.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Single post with page title?’ is closed to new replies.