• Resolved axelya

    (@axelya)


    Hello there !

    In my front page (index.php ) I have two full posts.
    I want to have two page titles separated with –

    I tried different approaches but the best I got was one title from one post.

    Is there a way to get what I want ?

    Thank you for reading this.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Please explain a little more what you want.

    If you want to show the titles of the two posts side-by-side, what do you want to do with the content?

    AxelYa,

    Can you please provide a link to your site?

    Thread Starter axelya

    (@axelya)

    Thank you guys !
    Check My site .

    I am going for resemblance to paper magazine. I do not use single.php in my theme. All content is displayed with index.php.
    Two articles per page – then you “flip the page” .

    Although, if you go to article from Contents page, you see the single view. No problem here with page title.
    But, in front page I have two articles and I’d like to have meta title displaying both articles.
    Otherwise, I have just blog name and description – general things.

    I have tried Headspace2 plugin and looked into others, tried hacking meta title, but couldn’t get it.

    Any advise would be highly appreciated!

    Sorry, but I still don’t understand. Do you want two articles side-by-side, or just two titles at the top of the page with one article under the other? Or something else?

    ---------------------------------------------------------------
    |   title-1                 |            title-2
    |                           |
    |   article 1               |         article 2
    |
    Thread Starter axelya

    (@axelya)

    vtxyzzy I am not talking about layout – it is about page title.
    Meta tag – title.
    It is about seo of my site.

    Sorry if mislead you.

    AHH – you said meta title, but I completely missed that. Sorry!

    I think this will work for you. It is a little odd because you need to do your query before get_header(), but it seems to work on my test site.

    First, add this function to functions.php:

    <?php
    function mam_title_filter ($title) {
      // Function to replace the meta title.
      global $mam_global_title_filter;
    
      if ($mam_global_title_filter) {
        $title = $mam_global_title_filter;
      }
      return $title;
    }
    add_filter('wp_title','mam_title_filter');
    ?>

    Then, in your template, use code like this (with your own query if not on blog page):

    query_posts('caller_get_posts=1&category_name=bcategory');
    if ( have_posts() ) {
       while ( have_posts() ) {
          the_post();
          $titles[] = get_the_title();
       }
    }
    rewind_posts();
    $mam_global_title_filter = "";
    if ($titles[0]) $mam_global_title_filter = $titles[0];
    if ($titles[1]) $mam_global_title_filter .= ' - ' . $titles[1];
    
    get_header();
    $mam_global_title_filter = ''; // Turn off filter ?>
    Thread Starter axelya

    (@axelya)

    Thank you vtxyzzy, I really appreciate what you did here.
    I am gonna try it tomorrow ( it is really late here ) as I have fatal errors all over my page. I need to recheck the loop I have.
    Now I have unexpected endif endwile or otherwise undefined function $titles.

    Hope tomorrow lucky

    Thread Starter axelya

    (@axelya)

    I got it ! Works perfect !
    removed line query_posts('caller_get_posts=1&category_name=bcategory');

    and …

    Tremendous thank you !

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Two titles for one page – is it possible’ is closed to new replies.