Jump to content

WordPress and Editing Content


BorysSokolov

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/281945-wordpress-and-editing-content/
Share on other sites

  • 3 weeks later...

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

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.