How can I make a customizeable widget area? - php

I know that I can go and change my theme's style.css file to change the background color of my widget areas, or if I make a custom widget area, I can give that a specific class and thus a custom background image in the style.css, but I need to give the user control for a few widget areas.
I have searched and searched and have not found any relevant information. Does anybody have any idea how I could do this? I really don't know how to make a widget AREA customizeable, and I would really appreciate any pointers in the right direction or assistance that anyone can provide.
EDIT
To be clear, I know how to add a custom widget area to my site. I have no idea how to add a customizeable option to the widget area, rather than a custom widget. As far as I understand it, widget areas are a set thing, are they not? Any pointer to a theme that does this would be greatly appreciated, as all of my google searches only end up pointing me to how to create a custom widget area, rather than a customizeable widget area.

Check the following two links if it is helpful for you.
http://theme.fm/2011/06/tutorial-creating-a-twitter-widget-for-wordpress-91/
http://wp.tutsplus.com/tutorials/creative-coding/building-custom-wordpress-widgets/

My understanding of your question is that you are looking for a way to allow the client/admin to modify the widgets that are displayed on any given page/post (rather than modify the widgets themselves).
This is a problem I have tried various ways to solve, never adequately imo. First of all there's the option to create a widget area for each page dynamically. I've seen it in commercial themes, I've done it myself, it is not without it's problems as you can see here - Register new widget position moves existing widgets
There are plugins that can do this, again not without their drawbacks. This plugin;
http://www.codeandmore.com/products/wordpress-plugins/wp-page-widget/
http://wordpress.org/plugins/wp-page-widget/
Is great, I love it. BUT it does not work on custom page template, be aware (I've not looked at modifying to allow this, I've seen a post by the developers saying they have no intention of adding this).
There is this plugin - http://strategy11.com/display-widgets/ by the developer of the Formidable plugin, for me it makes the widget area far too complex if you have a lot of widgets and a lot of pages.
Finally there is what I ended up doing recently - using this code by Chris Coyier
http://digwp.com/2010/04/call-widget-with-shortcode/
To do my own custom code using the Wordpress function the_widget (http://codex.wordpress.org/Function_Reference/the_widget) to deploy certain widgets on a page by page basis.

Related

Elementor add new custom responsive breakpoints

I'm making a little plugin that will add a new option for responsive. But I have no idea at the moment and I’ve been looking for hooks everywhere, but I feel like Elementor’s team has locked that option. Can someone help me where I could find a hook if it exists at all. So I want certain content to be displayed on a specific screen (which I would add using a code).

What is the best way to bypass Wordpress's HTML sanitization so I can use bootstrap html in Wordpress?

I'm trying to get on developing websites on Wordpress for easier management for the future admins.
I have created a bootstrap theme on my own. I got all the pages smoothly into Wordpress and are now easy to edit. However I have this one page which has tables, buttons, glyphicons and once I click the "graphic" view while editing the page it breaks it.
So I was thinking that that won't do and I decided to create a new plugin to fix this problem. A simple plugin which has few textboxes on the admin settings page and then just prints the texts on the page where I want them to go.
However I tried to look for tutorials and I'm just overwhelmed. I have gotten my plugin to work somewhat. It has a admin setup page and it can print customized text to a page where my shortcode is. Thanks to this post!
However, I still don't know what to do from this point on.
My question is: Could you help me by giving me an example code to get the same kind of textbox to my plugin's admin page as I have while editing/adding new pages (with graphic view) which saves the text and displays it on a page.
I have no idea if this is the way to go but I can't think of anything else right now. I was thinking that the settings page has a couple of textboxes and the text in them goes where I want it to go on a page. So the future admin won't see the unnecessary html code and therefore can't break it.
I would abandon the "plugin" idea. There are several more elegant ways to do this besides writing a plugin.
By far the easiest to implement is this:
1. Store the html in a "Custom Field" https://codex.wordpress.org/Custom_Fields
2. Display the contents in your page (or post) template https://codex.wordpress.org/Custom_Fields#Displaying_Custom_Fields

Widget or Plug-in? Building a theme and unsure how to approach optional content

I have a question regarding how best to build a widget/plug-in for WordPress.
I have tried to code this thing out but unfortunately to no avail but that's because I'm increasingly thinking I'm going about it the entirely wrong way.
This is what I'm trying to achieve:
I have built a theme from scratch. In this theme I have two content areas. The larger of the two contains the main content and the smaller of the two (proposed widget/plug-in) contains supplementary information (opening times, Facebook feed). I don't want this widget/plug-in to appear on every page and would like the ability to turn it on or off within the usual WordPress admin area.
The impression I am getting is that I can build the widget that contains the content I want (with necessary forms to change said content) but it is either on for ALL pages or off for ALL pages, no sort-of page specific functionality. That's where I'm thinking a plug-in would extend the functionality and allow me to be more page specific with it. That is my current set-up with a theme I'm running and plug-in I added (neither of which were coded by me) but I would like to repeat it as best as possible.
Would it be right to assume that widgets are not really designed to have page specific functionality and that function should be left down to a plug-in?
I appreciate this question asks nothing really in the way specific advice but I would just like an opinion or two on the best approach before I go away and create it - this is my main struggle at the moment.
Thanks for looking.
This can be done with the Jetpack plugin. Once activated you can choose what widgets display on what pages:
The Widget Visibility module enables you to configure widgets to appear only on certain pages (or be hidden on certain pages) by using the Visibility panel.
Visibility is controlled by five aspects: page type, category, tag, date, and author. For example, if you wanted the Archives widget to only appear on category archives and error pages, choose “Show” from the first dropdown and then add two rules: “Page is 404 Error Page” and “Category is All Category Pages.”
Originally posted here
It is also possible with the Display Widgets plugin.
This is a common problem. The usual remedy is to use an existing plugin that allows widgets to be tied to pages.
The 3 most popular plugins for this are:
JetPack
Per Page Widgets
Widget Logic

Wordpress Styling

I am new to using Wordpress as a developer as opposed to just using the dashbord but am struggling to understand a few things and would really appreciate some help.
For a site that does not require a blog - do you just create custom/specific page templates for each page that your site requires?
If so - presumably you code the content directly. But then how does the client edit their website's about page or any other page for example - because doing it through the dashboard isn't going to use the necessary CSS hooks without using classes, id's and HTML?
As a beginner to Wordpress - I can't see that posts are used on sites that don't have a blog, but am I correct or is using posts the way a client can edit content on their site, but just have posts styled to look like normal content?
Or am I wrong in thinking a company (I am starting as an intern at a web dev company that use WordPress) provides the tools or at least configures WordPress to enable the client to change content?
Any help getting me to understand the basic concept and way a developer would create a custom WordPress site would be much appreciated. Thanks in advance.
You can use page.php. In WordPress everyone create at least one custom template type to get wider design for custom pages.
You can refer here for more info.
Use Advanced Custom Fields with page templates. Say you are making an About page, call that template about and select that template in the backend editor. Once you save the page, the acf fields will show up and you can populate the content.
ACF: https://www.advancedcustomfields.com/
Page Templates: https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

Add custom content to a wordpress theme template

I'm in the process of customising a theme (styling, css, etc). However, I ran into a small problem, basically I wan't to include an introductory message at the top of the home/index template, and then have it as an option(text area) in the theme options panel. How do I go about doing this. Sorry for the noobish question, haven't found any straightforward solution yet. Thanks.
This is a significant customization that will require changes to the PHP code for the theme. You need a PHP programmer, preferably one who knows WordPress.

Categories