Hey guys I have a plugin and its displaying info on /courses.php (using theme)
How can I get it to display info on /courses/single_course.php
I figured I'd just have to make a /courses/ folder in theme and have single_course.php inside that. However this doesn't seem to work.
I've tried googling but I'm struggling to figure out the keywords to solve this problem! ^_^
OK edit cause nobody is understanding:
I have plugin working. This is a custom plugin
I want to know how to make the following work http://www.example.com/plugin/index.php http://www.example.com/plugin/index.php
Currently to make http://www.example.com/plugin work you just need to create plugin.php in the theme directory and give a callback to a function in the plugin.
Creating /wp-content/theme/themename/plugin/index.php did not work as anticipated.
WP uses specific directories for placing its themes and plugins tom maintain organization standards.
// Pointing to theme WP themes directory
$_SERVER['DOCUMENT_ROOT']."/wp_content/themes/"
// Pointing to theme WP plugins directory
$_SERVER['DOCUMENT_ROOT']."/wp_content/plugins/"
or you can use the built in functions in wordpress
// for themes in any php file after headers
get_template_directory_uri() . '/js/custom_script.js'
// for plugins in you main plugin class
plugins_url('/js/newscript.js', __FILE__);
I would recommend keeping plugins in plugins and themes in themes. What you may be looking for is creating some extra plugin features which will require you to include you extra php functions and classes when the plugin in question is loaded.
First create a folder in under your plugin directory and chmod it with proper web securities
cd /path/to/wordpress/install/wp-content/plugins/your-plugin/
mkdir php
chmod 755
Next either copy or create and edit the new single_courses.php file. I've listed a quick method below if you are creating the new file from scratch. Otherwise just cp it over. In both cases we need to insure proper web access right using chmod.
cd /path/to/wordpress/install/wp-content/plugins/your-plugin/
echo -n "/*Extra Plugin Functions*/" > single_courses.php
chmod 644 single_courses.php
Now we need to be sure to include the new file in our main plugin file
/* Main Plugin File :: ./wp-content/plugins/your-plugin/theplugin.php */
...
include_once $_SERVER['DOCUMENT_ROOT']."/wp_content/plugins/you-plugin/php/single_courses.php"
...
Thats the basic way to go about it. Use the same process for hooking theme php files as well. Always make sure when creating directories and files on your server that proper security is put into effect or you open up your web directory and or server to get hacked.
Hope it helps...
You have to give us more information on what plugin you are using and what you are trying to achieve. The solution may be as simple as pasting a Plugin provided shortcode into the post area of the desired page. Alternatively you may have to edit the plugin itself.
Related
I'm trying to modify a theme in Wordpress, I'm using it in a local server, but when I modified the style page of the theme, I don't see the result in the page.
My question is if someone knows How to fix the problem or well, How to modify the theme, but with really changes.
Make sure that no caching plugin like WP super cache or WP Rocket is enabled. Finally, make sure the style.css file is writeable by the server with permission like chmod 755.
If the above does not help, you can use a custom CSS plugin (https://en-gb.wordpress.org/plugins/simple-custom-css/) and add your CSS code using its interface (cleaner and less hassle for everyday users).
I have problem with running javascript codes in may pages.
I tried testing my code in xampp and it was working.
but I can not see them when I add them to my pages or my posts in my host and I installed wordpress again and it wasn't working.
Please help me
There are a few ways you can include JavaScript files in WordPress, I will give you one example using your child theme.
First you need to validate whether or not you actually have a child theme. Use FTP to login to you server and go to the wp-contents/themes directory. There you will see all your installed themes (in your case betheme). If you do not have a child theme follow these steps:
Create a new directory in your themes folder (betheme-child).
Upload your JavaScript file in this directory (for example script.js)
Create a new file called functions.php and add the following code to it: (surrounded by php opening and closing tags):
add_action('wp_enqueue_scripts', 'enqueue_child_scripts');
function enqueue_child_scripts() {
wp_enqueue_script('child-script', get_template_directory_uri() . '/script.js');
}
Login to your wp-admin and navigate to your themes
Enable your child theme instead of your normal theme.
Go to the front-page of your website, look at the page source and check if your JavaScript file is being loaded.
If you are using cloudflare, turn off minify JS.
I am helping out creating a few wordpress templates. I've been sent over the basic content (wp-admin/wp-content/wp-includes folders and other wp-* files).
They've already created a new theme, and one front-page.php file. This file includes "parts" such as get_header and get_footer.
Essentially now they'd like me to create new templates using this theme, and php variables to make updating easier. My question is - how can I view this so I can see what i'm making?
I downloaded MAMP and set up a local server, and if I create a sample .php file in the htdocs folder, that page appears correctly. However when I paste the Wordpress folder that I was sent, nothing loads. Is there a special way to get a front-page.php including partials to load within a theme? Am I missing something obvious here?
You will have to Install WordPress completely in order to make it work. Then you will be able to add your folder in the "Themes" folder of WordPress..
You can Google "How to Install WordPress on Mamp" for more info... you will find plenty of websites helping you.
I also suggest you read a few blog post on how to create WordPress Themes... :)
Good luck
I'm trying to get WordPress to power a blog on an existing php site. I just want to have a directory www.mysite.com/blog and have wordpress running the pages in that directory, using the same look and feel as the rest of the site.
I'm using the method described in this article :
http://codex.wordpress.org/Integrating_WordPress_with_Your_Website
I already have everything up and running, but I can't find the appropriate php files to edit the css in the wordpress template. I don't know wordpress at all, so I can't trace back to the correct file without knowing the wordpress syntax.
I'm using the WordPress TwentyTwelve them. Can somebody tell me which php and css files control the right hand menu layout?
You can find the relevant files here:
http://yourdomain.com/wp-content/themes/twentytwelve/
The main stylesheet is style.css and the php files are all in there as well to edit to your liking.
NB. if you included the wordpress folder, it will be .../wordpress/wp-content/ etc.
I'm using WordPress 3.5.1. On my web site, the image paths for my post thumbnails, instead of directly linking to the image (i.e. /wp-content/uploads/image.jpg) are linking to /wp-content/uploads/cache/image-slug/12314335235.jpg
Images 'inserted into posts' show up using their original URLs (i.e. /wp-content/uploads/image.jpg). The cache somehow only applies to post thumbnails.
I've searched for why this is happening, but haven't found any solutions. If it makes a difference, I used to have WP Super Cache installed, but it's been a few days since I've properly deactivated and deleted the plugin.
Why would this be happening, and how can I stop it (and pull the images directly)?
Thanks!
Enable/Disable Caching in wp-config.php.
Another caching mechanism you could take advantage of is the default WordPress object cache. You can enable or disable the native WordPress object cache using your wp-config.php file, like so.
define('WP_CACHE', true);
Simply add the above code directly above /* That's all, stop editing! Happy blogging. */ using any text editor (Notepad is fine) and save the file.
For me, it was malware that had installed itself onto my site, the docs and cache folder where simple a hideout to execute its malicious code (wordfence flagged all the files). I couldn't delete it through the wp-files plugin, so i did it through ssh using the command
cd /home/bitnami/apps/wordpress/htdocs
sudo rm -f -r docs