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 8664539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:15:53+00:00 2026-06-12T17:15:53+00:00

I’m trying to get a wordpress excerpt from a page to appear in a

  • 0

I’m trying to get a wordpress excerpt from a page to appear in a styled area of my footer. I currently have the following, which gives me the title and all of the content:

<?php
$page_id = 2;
$page_data = get_page( $page_id );
$content = $page_data->post_content;
$title = $page_data->post_title;
echo '<h3>'. $page_data->post_title .'</h3>';
echo '<p>'. $page_data->post_content .'</p>'; ?>

I’ve tried various combinations of post_excerpt instead of post_content, and have tried emulating and editing the example here: http://codex.wordpress.org/Function_Reference/get_page but am not having any luck. A few times I’ve tried examples from other people, but there has been no content at all.

Could this be because I’m trying to get it to display outside of the loop, or have I just not hit the right combination yet?

Thanks.

  • 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-12T17:15:54+00:00Added an answer on June 12, 2026 at 5:15 pm

    Why don’t you just limit the string using substr()?

    $content = $page_data->post_content;
    $excerpt = substr($content, 0, 155);
    

    something to that effect

    at that rate, you don’t need to try and find the true variable of the excerpt, and you can control the length, and whether or not it has ellipses at the end, etc.

    Also, if you NEED to find the excerpt variables, you could just do a var_dump($page_data), and see what returns the value you need, no?

    EDIT:

    you could try adding a manual excerpt to the pages using a function like this in functions.php

    add_action( 'init', 'my_add_excerpts_to_pages' );
    function my_add_excerpts_to_pages() {
        add_post_type_support( 'page', 'excerpt' );
    }
    

    EDIT on an EDIT:

    So I just dug a little deeper, and this little guy right here might help you out. Drop this in your functions.php file (source)

    add_post_type_support( 'page', 'excerpt' );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have an autohotkey script which looks up a word in a bilingual dictionary
I'm trying to select an H1 element which is the second-child in its group
I have an array which has BIG numbers and small numbers in it. I
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have a view passing on information from a database: def serve_article(request, id): served_article

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.