Is it possible to add editable sections to portfolio template?

SupportCategory: TA PortfolioIs it possible to add editable sections to portfolio template?
bjarkof asked 3 years ago

Hi, I’ve just started using your TA Portfolio theme and I really love it!
I’m using the portfolio template and I want to know if it’s possible to add more sections, that uses the content from my pages? For example add an “About Me”-section between the “portfolio-header” and the portfolio section, that uses the content from one of my pages. 

My URL is: http://bjar2323.mmd.eal.dk/wp
if it’s relevant 🙂

10 Answers
Best Answer
bjarkof answered 3 years ago

Thanks a lot!! Got it working now! 🙂 And for making it match the style of the rest of the page, I added a few div’s:

<section id=”about”>
<div class=”container”>
<div class=”row”>
<?php
$page_id = 137; // 123 should be replaced with a specific Page’s id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.
$page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object.
echo ‘<h2>’. $page_data->post_title .'</h2>’;// echo the title
echo apply_filters(‘the_content’, $page_data->post_content); // echo the content and retain WordPress filters such as paragraph tags.
?>
</div>
</div>
</section>

Rohit Staff answered 3 years ago

Hello, if you want to add more sections, you need to customize “template-portfolio.php” file in the theme folder. Thanks!

bjarkof answered 3 years ago

Yeah but the thing I want to know is, if I add a section to the “template-portfolio.php”, how do I make the section take the content from one of my pages? For example, if I make a section called “About Me” and I want the content in the section to be the content from a page in the wp-admin called “about”. So I just have to edit the “about”-page in wp-admin everytime I wan’t to change the content, instead of having to edit the “template-portfolio.php”. 

Does this make any sense? 😛 I’m relatively new to wordpress..

Rohit Staff answered 3 years ago

Hello, I’m afraid I can’t give you a solution for your question, as it need more other development work to do. Maybe I will add this in the next version. I hope for your understanding. Thanks!

bjarkof answered 3 years ago

All right, thanks your time and quick responses 🙂

bjarkof answered 3 years ago

My php skills is pretty much non-existent, but is possible for me to use this as a solution?

<?php 
$page_id = 123; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.

$page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object.

echo '<h3>'. $page_data->post_title .'</h3>';// echo the title

echo apply_filters('the_content', $page_data->post_content); // echo the content and retain WordPress filters such as paragraph tags.
Origin: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem
?>



- Found at http://codex.wordpress.org/Function_Reference/get_page
Rohit Staff answered 3 years ago

Hello, I think the code will work for you. Thanks!

bjarkof answered 3 years ago

Alright, but I can’t figure out from the comments what I have put into this?:
$page_data = get_page( $page_id );

And is my page id just the name of the page? Because when I hover the page as it is described, it just displays the name of the page..

Would you be able to show me an example where i use this code with a page called “about” in a section?

Rohit Staff answered 3 years ago

Hello, to get the page id, you just need to open the page for editing, please go to the URL bar of your browser, you will get the link like http://www.xxx.com/wp-admin/post.php?post=6&action=edit, the number after the post is the page ID, here is 6. You can insert the code between two section you want in “template-portfolio.php” file.
<section class=”blog” id=”blog”>
……
</section>

<section class=”about” id=”about”>
your code here
</section>
<section id=”contact”>
……
</section>
Thanks!

Rohit Staff answered 3 years ago

Well done!