Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

Changing page content dynamically


  #1  
Old Aug 29, 2011, 05:47 AM
chrisrap
 
2 posts · Aug 2011
UK
Hi

I'm new to the forum so apologies if I'm posting in the wrong area or asking a silly question I have read quite a few forum posts but I can't find an answer to my current problem with Atahualpa 3.6.7 running on WordPress 3.2.1

I have created a custom template (page.php) by copying index.php (pretty standard stuff so far) and I have played around with the content. My problem is that I want to create the entire body content dynamically from a second database, resident on the same MySQL server. I have a block of PHP code that I am including but part of that content creates a WP short-code to position a gallery (tag-gallery) and of course, because this is just being output directly WP isn't processing the code in any way so the short-code just displays on the page.

So, I think I need to put the page content into a variable and then pass this to the WP the_content() function to be processed and output. Is this correct ... and how would I go about doing that within Atahualpa? I'm guessing that I can also rip out a lot of the index.php code in my new page.php because it doesn't have to worry about comments, archives and posts - it just has to display a header and the page content that I create from the other DB.

Anyway, sorry for a long first post - I hope someone can point me in the right direction

Thanks, Chris R.
  #2  
Old Aug 29, 2011, 06:12 AM
chrisrap
 
2 posts · Aug 2011
UK
Apologies for the false alarm ... I think I have found the answer by examining the the_content() function. Seems much easier than I thought it would be but I have copied out the code inside the_content() and just filled $content with my own content generated from the database:

PHP Code:
    $content $chriscontent;
    
$content apply_filters('the_content'$content);
    
$content str_replace(']]>'']]>'$content);
    echo 
$content
Does that sound OK? Or have I made a terrible blunder that will cause problems later on?

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I adjust a div height dynamically ? dinoc Center area post/pages 7 Dec 21, 2010 08:05 AM
[SOLVED] changing the content width mr55 Center area post/pages 5 Oct 1, 2010 06:50 AM
Chronological, full content list of posts on page other than the home page joshsweiss Center area post/pages 4 May 19, 2010 01:47 PM


All times are GMT -6. The time now is 10:15 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.