I have WordPress 4.1.1 installed. I want to be able to write PHP code for specific pages. I found an answer on here which seemed like the best option I have come across so far, this answer can be found here:
How to add a PHP page to WordPress?
But - this does not seem to work and I cannot figure out why.
I followed the steps accordingly and I was able to complete all steps with no problem but when I preview the page its blank.
My only guess is that this might have something to do with version 4.1.1 - is there any reason this method would not work with version 4.1.1?
Your help is greatly appreciated.
If you need to add PHP to a page you need to open your themes template files in a text editor of your choice.
If enabled, access the Theme Editor from the Administration > Appearance > Editor menu.
http://codex.wordpress.org/Appearance_Editor_SubPanel
If your pages are blank you might have an error with your PHP code.
Personally I use this plugin:
https://wordpress.org/plugins/php-code-for-posts/
However you can also use custom page templates: http://codex.wordpress.org/Page_Templates#Creating_a_Page_Template
It depends what your personal code needs are.
Related
I have been using the Twenty Twenty-Two theme in Wordpress that is running on AWS lightsail multisite WP environment. I have found it easy enough to layout content using block editor.
Now I want to query data from the database (for now just want to use the Wordpress database where I added a table) and display that information.
I see tutorials for older versions of WP but I can not find any resource that provide much guidance on this. What I know thus far is I can not simply add php code to a page or post.
Please help. Frustrated at this point. Seems like this would be common task.
The question of "[how to] simply add php code to a page or post [in WordPress]" is not easy to answer because there are multiple ways you might approach it.
I recommend you search for phrases like
"add php WordPress functions.php"
"Why Child Theme custom php WordPress"
"how-to simple WordPress plugin custom php"
Good luck!
Actually i'm working on a wordpress website, which is related to school, i'm using universh WP theme which is purchased. I'm getting the below text as default:
Want create site? Find Free WordPress Themes and plugins.
See, i've marked those words. Actually its a dynamic page, i've checked the core code. It's only the
the_excerpt()
function. After that i don't have any idea, where it comes from. Also i've read this thread So please don't recommend that thread, its not working i've tried the way there mentioned.
P.S. Also the text will disappears when I login and try to edit the page.
What text editor You use ? Most easy way will be open folder with theme in some editor and search this string "Want create site? Find Free WordPress Themes and plugins." in all files - then You will know where they add it ... or You can check every file, because this string must be included somewhere, maybe in function.php they add some modification to the_excerpt();
I think when you ass content in post default editor then is not showing in the_expert() function
So you can add content in expert editor then after call the_expert() funtion
Check that your theme is not using the get_the_excerpt filter to prepend that phrase to all the excerpts.
Additional, if you only checked the files that load for that specific template, I would recommend that you run a search for that string for the entire theme. The source of the issue might stem from functions.php or even some JavaScript file.
Please update the core files or update version of your WordPress. Use Latest one.
I created a webpage in Standard HTML and CSS and everything looks / works exactly how I want it too.
Now I need it to appear as it is on a wordpress site (http://www.texasenergyessentials.com/). I already created a template page and can see it in the template select in the wordpress "add new page" window. I was hoping I could just select the template and leave the text editor blank but that doesn't seem to be the case. All I get is a completely un-formatted page that says welcome guest.
What is the easiest way to get https://gist.github.com/anonymous/8545681 to work on the aforementioned wordpress site? ?
Thanks!
P.S. Please don't link any codex files I just spent 2 hours digging around in them :(
Try to read and understand how http://codex.wordpress.org/The_Loop works
Install this theme https://code.google.com/p/wordpress-naked/ and try to work your way to the desired theme by editing theme files. That will be much easier.
Maybe the problem can be understood by reading the template hierarchy:
http://codex.wordpress.org/Template_Hierarchy
(especially check the visual overview)
If you name your file page-[insert-page-id-here].php Wordpress will use it for the page you've created. Get your page id by editing the page and looking it up in the url.
I'm having troubles getting the official Wordpress plugin for Sublime Video working.
I'm adding in the player to a post using the plugin, the preview within the plugin displays fine and the short code is created and inserted into the post as expected.
The problem comes when I view the actual post - the shortcode is removed but it is not replaced with anything. I've been debugging and it's become apparent that Wordpress isn't executing the shortcode handler.
No PHP or Javascript errors are being reported anywhere and I'm not at a loss as to what could be causing this!
Any help would be much appreciated, and if you'd like to more details just say what and I'll provide them.
Found the solution.
The people who had developed the theme (not me!) were using content() to display post contents rather than the_content() which was causing the issues.
im looking easy steps for convert any html/php template into a very simple wordpress theme for personal use. I have a site, in there i want news at the begining using the wordpress interface, i worked a lot with wordpress and i made some themes, but modifing already made ones, so i didnt care a lot about the code.
So, lookin in internet i dint found a good step by step tutorial in order to create a simple theme in wordpress from 0. Remember that i dont need sidebars, widgets and soo, i only need "the loop", or, the last 3 post made.
It's as simple as installing wordpress correctly and then including the wp-blog-header file into your pages. Doing so will give you access to all of WP's functions.
require('/path/to/wp-blog-header.php');
$posts = get_posts('arguments');