Tagged: , ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #3749


    Thank the heavens for Avisio, another incredible Kriesi WordPress theme. Quick question:

    Let’s say that a WordPress page of mine has post ID #123.

    Can you please tell me the PHP code I would use to display the following:

    – the title of that page, with its permalink

    – the “Additional Headline” text for that page (like a subheading)

    – the content of that page

    In terms of formatting, I’m super happy with the standard Avisio formatting; the title has I believe class “siteheading” (with its jazzy font replacement) the content has I believe class “entry-content”.

    If I knew PHP I wouldn’t dare ask such a simple question. If the experts out there could please share your PHP knowledge, it would really make my day! Thank you.




    you can display the tirle by using following code:

    <h1 class="siteheading">
    <a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link:','avisio')?> <?php the_title(); ?>"><?php the_title(); ?>

    The additional headline is called in header.php:

    $headline = get_post_meta($post->ID, "_headline", true);
    if($headline != "") $headline = '<h2>'.$headline.'</h2>'


    echo '<div class="center">';
    if($headline != "") echo $headline;
    echo '</div>';

    The content displays with following code:



    There’s something missing from this code. Quick review- the code you gave me was to display a certain page’s (1) title, (2) additional heading, and (3) content. I want to dynamically generate these three pieces of content, but I want to hard wire into the PHP script the post ID of the page whose content will be delivered. The code you gave me is here: http://pastie.org/1796465 but I don’t see where I’m supposed to insert the post ID!!!

    What PHP code is needed to say: “display the title, additional heading and content from post #123”???????? Please let me know. Thank you for your help Dude.


    I am a PHP idiot but after researching this, I believe I should use something like:

    WP_Query( ‘page_id=123’ );

    if I want to query data from the page whose page ID is #123 (it’s a page, not a post).

    I took that function and combined it with some of the code above and I now have this:


    Again, the goal here is to get the website to display, from the page whose page ID is #123, (1) the title in h1, (2) the “additional headline” in h2 (the “additional headline” is that field whose data appears across the top of each Avisio page) and (3) the content from the page, as regular sized text.

    This code I wrote does NOT break my website, so for me that’s major progress- but it fails to display any text at all!

    Can someone on the forum who knows PHP please give me a hand? You would make my weekend if you could fix this code- you’d put me out of my misery! Really I would so much appreciate it, I am almost done with this Avisio website I’m building!!!!!



    I’m not sure where you’e trying to display the page content, and I appreciate this is just a code snippet in your pastie link but is the code using the loop?

    You can’t use the WP_Query inside the loop (it just won’t work…) and you must have the loop for it to display correctly (and also handle error messages), so you code should look like this:

    $query = new WP_Query( 'page_id=123' );

    if (have_posts()) : while (have_posts()) : the_post();

    echo '<h1 class="siteheading"> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a></h1>';

    $headline = get_post_meta($post->ID, "_headline", true);
    if($headline != "") $headline = '<h2>'.$headline.'</h2>';
    echo '<div class="center">';
    if($headline != "") echo '$headline';
    echo '</div>';

    echo '<?php the_content();?>';

    endwhile; endif;


    Let me know how you get on.


Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Simple PHP question for Avisio’ is closed to new replies.