Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Alright, Im in the process of creating a custom wordpress theme.
My index page is getting super crowded with code so im wondering..
If i were to create an additional page.. say, "topplayers.php"
would I be able to load that into the position where I want it to appear on my index page?
Try looking into php includes. I'm not too familiar with wordpress themes when it comes to their creation but something like:
<?php include('path/to/file.php'); ?>
Should provide the functionality your after.
If it is integral to the site - i.e if its not there the site shouldn't load, you can use require instead of include.
Sure you can make an include.
http://php.net/manual/en/function.include.php
One cool way of doing it (if you place the file in your wordpress directory) is this way:
<?php include(get_template_directory() . 'topplayers.php'); ?>
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have to do some work on older version wp site (4.3) whenever I create a new page and try to access it always give me front page. Other old pages are using templates and they are displayed fine but I need to have a page without a template. What should I look at to find the problem in order to be able to create a new page?
This is the mechanish fallback of wordpress. In order to have a theme you just need two files index.php and style.csc. see about template hierachy.
If you need a new page you must:
1) create a file page-.php in the folder of using theme
2) from the Gui of wordpress create new page with title
then if you write the proper html/css you are going to see the template that you have created
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I've got three home pages:
1. home
2. home-student
3. home-teacher
Based on their custom user role (student, teacher or not logged in) I would like to show a different homepage. My knowledge of PHP is pretty basic, so I'm hoping for an easy answer (or line of code I could paste in my child theme). Many thanks!
Since you do not have a lot of php experience, you may want to use a plugin like this one
https://wordpress.org/plugins/user-specific-content/
You can then use shortcodes in your homepage content to designate who see what. Like...
[O_U user_id="1"]Content goes here[/O_U]
There are other methods, but they would require hacking the page.php template. As long as you're not trying to have the header and footer look different, the plugin should late you have different page content for different roles.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a Drupal site and I've have made a decision to migrate it to Wordpress. I want to keep the same design/theme in my new WP site.
I'm wondering what part of current Drupal theme can be used in the new WP theme. Can the HTML/CSS, JS be re-used? If yes, the how?
I don't have any experience with theming so I am curious to know this.
Any help would be really appreciated.
Thanks in Advance!
I see no reason why you couldn't do that the css and js should work fine with no modification at all. You will need to do a lot of work on the html first you will have to remove the php or template tags that drupal uses (Not sure how it does it's templates). Then what I suggest you do is take a look at another wordpress theme and replicate the structure and theme files. Take the html from you drupal theme and add it to the wordpress pages style it how you like, now you will need to do some research on how to get what you need out of wordpress this is often done with php tags so your theme files for wordpress will need to be .php it is best to have a header and footer php that you can include all you links to the css and javascript. Hope this helps comment bellow if you need more help.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I have to build a custom plugin for a client who is using wordpress. I am dont use wordpress so I dont know how it works. I just want to understand how this will work..
I have to build them a search plugin that will be display inside a page. It will get data from an excel spreadsheet that lives on the server, so they can edit that content and it will pull all that data into the page. Is this a plugin? where do I start?
I will also need to use jQuery to do some more to the data once on the page.
Wordpress plugin develop does take some work, but it is extremely well documented. I would go to the following pages in the order that they are listed:
http://codex.wordpress.org/Writing_a_Plugin
http://codex.wordpress.org/Plugin_API
http://codex.wordpress.org/Plugin_Resources
Once you've gone through those pages, you should have a lot more information on plugin development and how you might do what you are after.
I had the same question. Looking at some plugins, it seems they are using short codes to place plugins in specific pages. Here's the link in wordpress:
http://codex.wordpress.org/Shortcode_API
For WordPress 6.0 please check this page:
Plugin developer handbook
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Many times, while developing Wordpress plug-ins, themes or widgets, we use unnecessary lines of code and logic.
As the time goes we find and get better solutions for same logic which is tidy, simple and good in performance.
Here I would like to know such Tips & Tricks, that makes our wordpress development life simple and enjoyable.
(I will also add some of my Tips & Tricks here.)
Including javascript :
To include javascript in wordpress plugin,normally we use
wp_enqueue_script('PATH_TO_JAVASCRIPT');
But this include javascript in both front side and admin side of site, if that plugin is active.
If you want to activate it on only admin side use
if(is_admin()){
wp_enqueue_script('PATH_TO_JAVASCRIPT');
}
2 . Using wordpress classes, objects, functions outside wordpress:
To use wordpress classes, objects, functions outside wordpress, simple include wp-load.php file in your script
<?php include_once 'wp-load.php';?>