I'm hoping to use SASS with a new WordPress theme I'm using.
So far, I haven't been able to get it to work on my localhost using Windows. I'm assuming this is because I don't have Ruby installed, which is easy enough to install.
My question is this: If a user of my theme wants to develop their site on their localhost, will they also need to install Ruby?
If so, is there any way around this? I would prefer that users just download the theme and be able to use it without any other prerequisites.
Any info would be really appreciated.
Thanks!
SASS is just a preprocessor for CSS so you only need it on your system in order to process the SASS files into CSS.
One thing to note though, if you decide to minimize your CSS for the distribution of your theme, you will need to model your root SASS file with the following comments:
/*!
Theme Name: {Theme Name}
Theme URI:
Author: {Your Name}
Author URI:
Description:
Version: 0.1
License: GPL-3.0
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
Tags:
*/
The "!" after "/* is important as this will tell SASS that this comment is important and it will retain it no matter how you want your CSS output. If you do not, SASS can strip out all comments (which you normally want) but without that comment header, WordPress will not recognize your theme as a valid one.
You will need to install ruby on your local dev environment to build your SASS theme. Your theme available for download should just have the versioned .css files not the .scss build files, though it shouldn't hurt to include them.
Related
I had researched about adding WordPress plugin in WordPress docker image, as in research I found the custom plugins can be added in docker-entrypoint.sh file. But I am not able to add custom plugins in entrypoint file. If is there any solution for this problem.
The docker-library/wordpress image does include a wordpress/docker-entrypoint.sh script.
However, the README points out:
This image does not provide any additional PHP extensions or other libraries, even if they are required by popular plugins.
There are an infinite number of possible plugins, and they potentially require any extension PHP supports. Including every PHP extension that exists would dramatically increase the image size.
So when you say "I am not able to add custom plugins in entrypoint file", it really depends on what error you have.
If you need additional PHP extensions, you'll need to create your own image FROM this one. The documentation of the php image explains how to compile additional extensions.
Additionally, the wordpress Dockerfile has an example of doing this.
I was wondering why .css file rewrite itself on Joomla.
I have bought Joomla template. In template manger under general settings I am using Development Mode On. If I use Development Mode OFF I am not able to change .css files.
For example: I am using theme which is located in t3-assets/dev/ theme i choose
When I use On mode I find section I want to change, it works. But after some time it rewrites it self. I was wondering how to prevent that if possible?
Some templates are overwritten alone , go to your server and take off the writing mode in the template folder.
My guess is that the template is using LESS, so CSS are compiled each time you modify LESS. If that is the case, you should not prevent it, but find the correct way to include your modifications (probably there's a "custom.less" or similar file for that).
I googled the same question but couldn't find the perfect answer, Can anybody make it clear on how to use LESS CSS in WordPress theme development? I don't want to rely upon online scripts.
I already tried https://github.com/sanchothefat/wp-less but no luck..
Your question is very broad? Too broad I think.
How does your develop process looks now? How do you want to compile your Less code.
Notice that Less code should be compiled into static CSS. Of course you can use the in browser version too, but in-browser compiling is not suitable for production.
Basically you should compile your Less into CSS first. You can compile styles.less into styles.css and upload that file into your wp-content/themes/yourthemes folder. Instead of styles.css you can use any other file and integrate in with the wp_enqueue_style function into your theme.
In the case that you want your Less code via the WordPress dashboard, you can install the WP Less to CSS plugin. This plugin compiles your Less code into a static CSS file as described above.
The JBST theme use the Less plugin describe above. You can also take a look at the Roots.io theme, which uses Less, npm and grunt to build.
A process that, for now, I use occasionally. I installed Koala, which creates CSS files from LESS on the fly. Then we create style.less and as we write code in it - through, for example, WinSCP upload to the server in the theme folder.
You can also use a copy of the site on a local server like OpenServer (OSpanel). With Koala create CSS automatically from LESS in theme folder on local server. After changes - upload them to the work server.
You can use Grunt.js to compile the file locally or some app lice CodeKit. Also you can use some wordpress plugins like this one: https://wordpress.org/plugins/wp-less/
I used that plugins before an it works fine.
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.
Having a really baffling issue with permissions, WordPress and theme files.
I have a fresh install of WordPress and tried uploading the theme I made for my client. It uploaded fine but it doesn't show up in the Manage Themes menu. I checked everything was uploaded and it was. Checked permissions (even set them to 777 at one point) and they were fine. But the theme doesn't show up.
Here are the different scenarios I've tried:
Using the Install Themes menu and uploading a .zip (failed)
Duplicate twentyten folder and contents (worked)
Duplicate twentyten folder and used my theme files (failed)
Duplicate twentyten folder and used my theme files and their style.css (failed)
Uploaded my theme WITHOUT style.css (gave missing style.css error)
Uploaded my theme WITHOUT style.css and put in twentyten/created one from scratch (both failed)
I'm on my clients MediaTemple hosting and I've never encountered this error. Their support has yet to get back to us.
Does anyone have a similar problem? Solution? It's possible I can give you FTP access if needed.
CSS Head (changed values but format and everything is still the same):
/*
Theme Name: Example Theme
Theme URI: http://example.com/
Description: WordPress theme
Author: Company
Version: 1.0
*/
Edit: Trying to access the folder through my browser results in a 403 error (works fine on twentyten). style.css can be viewed from the browser.
If you are using a MULTI-SITE installation of Wordpress, you have to first go into Network Admin, select Themes from the left menu and enable the themes you like to use before they can appear on the "Manage Themes" page in the Site Admin section.
Perhaps you are missing a required template file?
At the very minimum, a WordPress Theme
consists of two files:
style.css
index.php
http://codex.wordpress.org/Theme_Development
On Ubuntu 14.04 you can install the wordpress package simply using sudo apt install wordpress but then you have to set a link to the themes directory.
E.g. for your "newTheme":
ln -s /usr/share/wordpress/wp-content/themes/newTheme /var/lib/wordpress/wp-content/themes
I bet you have some special characters in your templates. This once drove me nuts to find.
Check your Template files and/or rename them until the theme shows up. I used a german "ö" in a templates name.
I had a very similar problem. Spent a few hours before I found that somehow when I moved my local site (probably using All-in-one Wp Migration plugin), a .htaccess file was created in the /wp-content folder. I don't remember what was inside this file but I think it didn't matter.
After removing this file everything was ok.
Is the theme folder name different than everything else? Is the Theme Name in style.css different than everything else?
I am guessing BOMs are the problem. They messed up my validation of a page once, as I tried to remove the BOM. Try using an editor and remove the BOMs. For Notepad++, the text editor I use, I just set the encoding to UTF-8 without BOM and saved. That solved my problem. Of course, your text editor may be different.
As I discovered at the end of tortuous troubleshooting, an old wp-config.php may cause newly installed themes to be undetected and invisible in /wp-admin/themes.php - I am not sure that you have the exact same problem but it looks very similar to mine and you might want to try your configuration with a wp-config.php newly generated by Wordpress.
Make a backup of your styles.css
Copy the styles.css file from twentyforteen to your theme folder.
Only change the template name at the top of the file
Re-load the themes page in WordPress admin; once you've seen it working,
Further-modify the new styles.css file as needed.
The problem could have been, that you uploaded it in .zip
Your php setting might disable the scandir. It may cause the wordpress cannot scan the theme folder
Solution:
find php.ini. You may run php --ini to get the php.ini file location.
Open php.ini,Search for disable_functions, then you may removescandir parameter.
Save and restart your php services.