BorysSokolov Posted September 7, 2013 Share Posted September 7, 2013 I am creating (or rather, trying to create) a small informational website using Wordpress, and I've pulling my hair out over how to edit the html on the pages. I understand that Wordpress is dynamic and it loads most of page content from the database, but if that's the case, how am I supposed to add, say php code in the middle of the page; or, a static piece of text next to dynamic posts? So far, the only solution I found was to insert the code between the functions in the index.php file; but that's just that, it only works for the homepage. What if I wanted to add a script or a piece of code to a different page? I hope somebody can clear this up for me. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/281945-wordpress-and-editing-content/ Share on other sites More sharing options...
QuickOldCar Posted September 23, 2013 Share Posted September 23, 2013 (edited) Wordpress uses filtering within the posts by default. Can find it in wp-includes/kses.php If it's just you posting data can edit the filter file directly, Can also add something like below in your functions.php file, refer to wordpress code pages to find out what they are. This one is to stop putting everything into a paragraph automatic. remove_filter( 'the_content', 'wpautop' ); Then you have plugins to get the job done. http://wordpress.org/extend/plugins/raw-html/ http://wordpress.org/plugins/exec-php/ You can also include(),file_get_contents() or iframe the script on a page, store it somewhere on your server or within the themes template file. Speaking of template file, you can also make custom pages. Here would be a simple template Make it a php file and drop it into your current theme folder. <?php /* Template Name: myPage */ ?> <?php get_header(); echo "Hello There"; get_footer(); ?> What you do is go and make a new page, and to the lower right select in this instance... myPage template Edited September 23, 2013 by QuickOldCar Quote Link to comment https://forums.phpfreaks.com/topic/281945-wordpress-and-editing-content/#findComment-1450804 Share on other sites More sharing options...
Solution BorysSokolov Posted September 26, 2013 Author Solution Share Posted September 26, 2013 Thanks. I ended up using a template page for the site. Quote Link to comment https://forums.phpfreaks.com/topic/281945-wordpress-and-editing-content/#findComment-1451247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.