Jump to content

Archived

This topic is now archived and is closed to further replies.

werdnags

2 Pages fed onto Homepage

Recommended Posts

werdnags

Hi,

 

Do anyone have any idea how I could resolve this problem I have please?  I am building a site for a client and they would like a noticeboard on their homepage.  I would rather they didn't have access to the DMS editor so I though a better solution would be to have a page setup for the noticeboard.  I would make it easy for my client to edit etc.

 

Is there anyway I can display 2 pages on the homepage.  1 for the main content and the other one for the noticeboard?

 

Thanks for any guidance.

Share this post


Link to post
Share on other sites
Danny

Hi,

 

As far as I know there is (I think) a plugin that allows you to display a page content on a separate page, but I am not 100% sure. Another method would be to create your own section and use it to display a specific page.

 

http://wordpress.org/support/topic/showing-one-pages-content-on-another-page


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
werdnags

Thanks Danny,

 

I managed to get it to work, this is what I have done:

 

  1. Installed plugin PLNEXTBOX
  2. Inserted the code below (found on a Google search), where 106 was my page ID
  3. $page_id = 106;  //Page ID
    $page_data = get_page( $page_id ); 
    
    //store page title and content in variables
    $title = $page_data->post_title; 
    $content = apply_filters('the_content', $page_data->post_content);
    //display the title and content
    echo $title;
    echo $content;
    
  4. I then put a tick again 'use PHP execution' - Hey presto I can now feed multiple pages into one!

  5. I had to ask my hosting to enable eval() also.

 

By enabling eval() does this leave me vulnerable?  My hosting said it should be okay as long as I wasn't feeding user data etc? - Any opinions on this?

Share this post


Link to post
Share on other sites
Danny

Please read the PHP manual - http://www.php.net/manual/en/function.eval.php

 

In my opinion, you shouldn't use it, but I am by no means an expert with PHP currently. I'll speak to one of our developers and ask their opinion.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Simon

you could have done the exact same thing with a shortcode...

 

in the box use [my-awesome-shortcode]

 

then in some functions file...

 

add_shortcode( 'my-awesome-shortcode', 'my-awesome-shortcode_function' );

function my-awesome-shortcode_function() {

 

$page_id = 106;  //Page ID
$page_data = get_page( $page_id );

//store page title and content in variables
$title = $page_data->post_title;
$content = apply_filters('the_content', $page_data->post_content);
//display the title and content
return $title . $content;

}

Share this post


Link to post
Share on other sites
werdnags

That sounds better Simon.  I have tried to take your advice.  

 

I thought I could install the customisation plugin and insert the code into the functions.php file.  When I do this my site is blank, no template, nothing.  When I FTP in and delete the plugin the site comes back.

 

I have tried editing the file via FTP also but still a blank site when I make the changes.

 

Any ideas.

 

Thanks.

Share this post


Link to post
Share on other sites
Danny

That's because the function didn't contain underscores, replace the code Simon gave you with this:

 

https://gist.github.com/anonymous/eac54feec7c6c3ec21bf


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
werdnags

Brilliant!  That now works.  I will get onto my hosting to disable the eval() function.  Thanks Danny and SImon!

Share this post


Link to post
Share on other sites
Danny

No problem.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

  • Similar Content

    • Lisa Haran
      By Lisa Haran+
      Hi 
      I have a map here http://www.iloveoffset.com/maps/
      I want to add several pointer locations to the map, but when I do they do not appear.
      On this map there are 2 pointer locations and as you can there is only one visible.
      Earlier today I added 7 and could only see 4 so there is something odd going on.
      My theme is up to date
    • clj182
      By clj182+
      Hello,
      I've been having trouble unlocking the template section for past couple of weeks. When I try clicking nothing happens. 
      I've deleted my custom css and removed plugins. Im down to having only the following plugins:
      Akismet
      Contact Form 7
      DMS Professional Tools
      Pagelines Updater
      WooCommerce
      It was working fine before i have no idea what's going on with it.
    • flourishdesignstudio
      By flourishdesignstudio+
      My DMS 2 site http://www.heart-stone.com/ will not save any new custom css... I can still edit templates and publish those but any custom css that I enter never saves.
      All WP files, themes, and plugins are up to date. 
      Any thought about what might be causing this?
    • flourishdesignstudio
      By flourishdesignstudio+
      Is there a way to edit the custom CSS via FTP? I know I can edit the custom code in the Chrome editor but is there a file path I can use to find and edit the CSS directly from our FTP?
      Thanks in advance for the help!
    • nizami
      By nizami+
      Using navbar section with correctly configured WP menu to display main navigation at https://elenaangel.com. 
      All fine in desktop viewport. Menu displays twice in hamburger mode. How to fix this please? 

×