i am writing a wordpress plugin and i want to make some changes on appearence of site.How can i change some html and css with my plugin?
What i mean is this:I do something with my plugin and i have some result with that.I want to add some css and make it beautiful.Where i want to make change is home screen.How can i do that?
For example,a theme's div class name is foo,another one is hoo.
Now when i want to prepend something to that div there is no similiarity.So i decided to write a little theme which is integrated to my plugin.
With another word,i want to change theme automatically by my plugin.Is that possible?
You can add new 'CSS' and 'Javascript' in header of you website using
<?php
add_action('wp_head', 'your_function');
?>
In that CSS file you can create whatever CSS classes you want. And yes this can be accomplished using plugin (But not recommended).
You will need to read a little bit about things like:
https://codex.wordpress.org/Writing_a_Plugin
http://www.onextrapixel.com/2009/07/01/how-to-design-and-style-your-wordpress-plugin-admin-panel/
http://wp.tutsplus.com/articles/how-to-include-javascript-and-css-in-your-wordpress-themes-and-plugins/
Good luck and eventually let us know please :)
Related
I am currently trying to develop a website for fun just to practice. I have written some PHP code locally on my computer together with some css and html. My question is if anyone is familiar with Wordpress? And if so, am I able to import my php files and css into wordpress and use both code and the tools that wordpress has?
Thanks in advance!
Absolutely yes. The first thing you should do is create a child theme.
In it, you will have a style.css file in which you can add all your custom CSS.
Also in there will be a functions.php file. You can add custom PHP in there.
If you're looking to do something more complicated, then look into writing a plugin.
You can create templates on WordPress.
How to create a template
On this template, you can save your PHP.
To add CSS to WordPress you can do that by going to Appearance > Customize > Custom CSS.
The path to your Custom CSS section may be different depending on what theme you use.
I am very new to wordpress. But have good knowledge in php, html, css and javascript.
I want to add custom font-resizer to my wordpress site. as shown below for example.
What would be the best and non-messy way to add the plugin code to my website.
I have looked at some tutorials online but it seems that I can't getting those.
Any help would be appreciated. thank you..
If you're trying to add that plugin specifically to your site, then its documentation suggests:
adding it through a widget that the plugin creates
or using this bit of code wherever you want in whichever template file: <?php if(function_exists('fontResizer_place')) { fontResizer_place(); } ?>
Does your theme have a place for widgets in its header? If not, you'll want to just place that bit of PHP somewhere in your header.php file.
Im a bit new to this side of Wordpress and wanted to get some help with the best way to go about this. I created a plugin and what i want it to do is have a simple form with a few fields that will write information to a stylesheet. In this case i have a admin.css file that i enqueued in my themes functions.php file and it works for style changes but it would be easier to have a menu in the backend that will write some info to that file.
how would i go about this and which is the best method?
well this will be done with fwrite function that i think more complex. try to add in simply tags and add_action in to wp_head directoly
I should edit the dynamic_sidebar() function on wordpress (hiding some categories, editing the template).
Is it possible? I read "you need to edit the core", but I don't have understand where is this "core" :)
Never edit the core. The reason is that if you change the default behaviour, themes you install might not work and updates to the wordpress engine will break your changes.
To change the way your wordpress behaves, create a child theme. Then add a functions.php file and in it create a widget that has your desired behaviour.
You can also register a new type of sidebar and a page templates that shows only that type of sidebar.
See: http://codex.wordpress.org/Child_Themes and https://codex.wordpress.org/Function_Reference/register_sidebar_widget
Personally, you sound like your just starting out so I will give you some advice. Never edit the core.
It's tempting for a quick fix. Everyone has done it when they didn't know any better, but you have the opportunity to learn the right way.
Approach your problem logically. What are you trying to edit it for? Hiding some categories? Use the internal widget system in the CMS and take them off. Delete the categories, or hide them with CSS {display:none;}.
Good luck my young Padawan. I hope you take some advice and heed it well.
Best way is to probably make a Child template using the plugin One-click child theme. Copy the file containing the function to the child template (using ftp) and edit it there. This way you can update your template and still keep your changes.
I have a page in HTML(index.html), and a folders named images, css, js that used in it.
Now i have to do this in WordPress. Is there any plug in to convert Html to WordPress or any other way to do this in WordPress? Please help me.. i'm a beginner in WordPress.
I am not sure of a direct way to implement a HTML page into a WordPress theme, but if you have made header and footer files for your website, then all you need to do is convert them to make them WordPress compatible.
You should refer to the codex.
You can also go for any of the WordPress frameworks listed here.
A WordPress theme is easy to understand if you know basic PHP. It has a set of files like
header.php // header file
footer.php // footer file
index.php // the index file
page.php // for your WP pages
single.php // for your WP posts
and some other files
Go through the codex and it shouldn't take long to get the hang of it.
You need http://themematcher.com/
It'll automatically take your site, styles, images etc and create a wordpress theme for you. Check it out
Search for HTML to WordPress theme conversion and you can find so many good tutorials.
Check this article:
http://thethemefoundry.com/blog/html-wordpress/
Theres really only three ways:
Hire a freelancer
Convert manually by referring to http://codex.wordpress.org/
Use an automated converter. Best one on the market is
https://htmltowordpress.io
here is the link for complete solution of this problem.
http://wordpress.org/support/topic/how-to-integrate-htmlphp-page-to-wordpres?replies=6
make sure to add
/*
Template Name: Custom Page Template
*/
piece of code in index.php page at top in your selected theme folder, not on ur main index.php file.