• Resolved straussy

    (@straussy)


    Hello,

    I am unsure how to go about organizing the static page content in the Child Theme php files.

    My new page template which will be used for most pages on the site is here:

    https://pastebin.com/RTfvaSWm

    With the query I can get the most recent posts to show in one column.

    My question is how to go about getting different pieces of static page content for the other column on each page. Should I create the content as posts and get each one from the database by ID? Or create a different template part and hard code each piece of content?

    There will be about 14 pages on the site and 11 will have the same layout.

    I would really appreciate guidance with this as I am new to WordPress.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael

    (@alchymyth)

    use the ‘normal’ loop code to get the content and title of the corresponding page (untested);

    https://pastebin.com/ep0QhR0h

    Thread Starter straussy

    (@straussy)

    Thanks Michael for your help.

    From your answer I understand that I should create the static content as posts and get each one from the database.

    I tried your code and the most recent post is displayed in the first column ‘Upcoming Events’ but nothing is displayed in the second column.

    Is there a way to get only posts from the ‘news’ category for the ‘upcoming events’ section (on every page) and posts that correspond to the page they are on for the second section i.e. admissions post on admission page, timetable post on timetable page?

    Thread Starter straussy

    (@straussy)

    Great issue resolved.

    So, I added ‘category_name’ => ‘news’ to the array and that means that only posts from the news category are displayed.

    For the second column, I realize now that <?php the_content(); ?>
    <?php } ?> gets the content input on the dashboard for each page.

    Thanks again

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Organizing Page Content in Child Theme files’ is closed to new replies.