WordPress - enable/disable a div like a widget - html

I am building a custom WordPress site with my own theme. Is there a way in WordPress that would allow me to enable or disable a div in the sidebar similar to the way I enable or disable a widget?
For example, I have a div that is for a newsletter subscription form and a div that is for a call-to-action button. Is there a way that I can allow the WordPress administrator to choose which page to have the newsletter subscription form and which page to have the call-to-action button dynamically?
I have been searching but was unable to find any information. Perhaps I didn't have the right keyword?
Any suggestion would be greatly appreciated. Thanks!

For that to happen you would either have to go for the somewhat tricky solution, but on the other hand more satisfactory; create a custom options page with a true/false-solution using the Settings API. You can read more about that over at Codex here: https://codex.wordpress.org/Settings_API . They here refer to a handfull of external resources to learn more. This guide helped me when setting up my first built-from-scratch page; http://ottopress.com/2009/wordpress-settings-api-tutorial/ .
The other solution would be to use a plugin. The top shelf, best in class solution - if you ask me - would be Advanced Custom Fields; http://www.advancedcustomfields.com/ . It's a little bit of work to first get it's head around, perhaps, but when you get going you'll probably never look back. Creating awesome options pages is a breeze, and you probably will end up making all sorts of elements on your page optional - just because you can. But there's a catch; to create options pages you will have to buy the Pro version of it.

Related

BigCommerce Lifestyle theme - add to cart show quickview instead of redirect to cart

i'm using the LifeStyle default theme for our bigcommerce based website, and i'm having difficulties figuring out how to use the quickview dialog instead of redirecting to the cart when I click dd to cart from the homepage (it works as I want it to from product section)
https://themes.psdcenter.com/theme-documentation/lifestyle-bigcommerce-theme-manual/
any help greatly appreciated!
looks like this is being set by a dynamic {{add_to_cart_url}} in the card.html file, found through templates > components > products. I agree that this information is not located in the docs by lifestyle developers.
You always have the option to reach out to the theme developers for some guidance/best practice advice from them directly when making this customization.
Some options to consider: You could write a script that overrides this default behavior, but that may not be the best route. You could also look at writing custom login in card.html specifically for the homepage. And based on card.html, it looks like to open quick view, the button has a class of 'quickview' which could be what's targeting the modal action. You could test with adding this class and making other modifications to the card.html. Search the card.html file for 'theme_settings.show_product_quick_view' to see how this works to help you achieve this on the homepage.

WPForms textarea doesn't display when published on a page in WordPress?

I'm using Be Theme in WordPress, and I'm using WPForms to create a contact form.
The form was set up correctly in the WPForms Builder (as far as I am aware), and I'm using the following shortcode in the SiteOrigin Editor (with paragraph turned off): [wpforms id="397" title="false" description="false"]
And this is the result:
Contact form with no textareas
I was thinking maybe there was a conflict between the SiteOrigin / WPForms / Be Theme, but I'm not sure. I also did some searching on Google, but I couldn't seem to find anything that addressed this exact situation that I'm dealing with.
Thank you to anyone who decides to help!
I found a solution!
I was using some CSS (to get rid of this ugly line that went through the page), and I guess it also disabled the input fields.
It's fixed now!

Regarding WordPress custom homepage

This is more of a process question than coding. I have a custom homepage with logo, menu, footer similar to other pages. But there are few other contents which are different in the homepage, as usual, i.e, a title, a description div, a social links div and a few more, which are only in the home page.
Now the question is, since I want the admin to change this dynamically, how should I easily implement this for the site owner. Should I make a top-level menu named Homepage in WordPress dashboard and add all these meta boxes (with title, description, social fields) on that admin page so that he can fill this in from the back-end or make a custom post-type with the mentioned custom fields? Or should I add a menu under appearance with the relevant fields to be filled.
I am confused about the standard way. I am new to WordPress and just learning. This clarification will help me get a pre-idea. I completed the HTML and now converting the site to WordPress. Just give me a general overview please, nothing detail, I'll get the rest done. I would like to know the difference between the options mentioned above in a nut-shell (what is for what actually) and what is the standard way to add the custom home page fields for the site admin to input page contents easily.
Thanks in advance.
You would need to create a static front page.
https://codex.wordpress.org/Creating_a_Static_Front_Page
Basically you can create a standard page and then from wordpress customizer make that page a front page. Client will edit it from the back end just as any other standard page.

Joomla article with custom buttons and images on the right

I have to create Joomla website. I am PHP programmer, but new to Joomla.
I have spent a lot, reading tutorials and other staff.
The website is very simple, it is visit card for restaurant.
I have installed Joomla 2.5. Spending two days I have managed to do the following:
- create menu
- create multi language site (2 languages) with language swicher
- create simple static pages (articles)
- create one page as contact
- create simple template just for my website
However, I cannot do some things and I have not found any answers in tutorials or google.
If you open this file http://img1.uploadscreenshot.com/images/orig/1/2621034793-orig.jpg you can see images with three different pages on the site:
1) Article with three images on the right.
Basically, I do not know what is the best practice to create article with some custom HTML in it (in this case these are images). For example, i can create table with two columns - one for text, another for images. Without Joomla I would create two divs, but how this can be done here??? Also with custom html I need to do the same for each language - I need to add images for each language, I do not like this. I really have not found any solutions for this. Do you have some suggestions?
2) Article with three buttons on the right side. This is article on landing page.
This is probably the same question - how to create article with some custom HTML in it (in this case these are three buttons - links to pages inside the website)? Again I can create table with text and buttons, but this should be done for each language. Is it a good practice? Do you have some other suggestions to create article with three buttons on the right side? Maybe I can create some custom module, but this sounds strange.
3) Contact page with google map.
I have create contact page with contact details. This is another question, I would ask other time.
Hello Renathy and welcome to Joomla!
1) You can of course insert divs in the editor and style them with floats; but as you mention this is pretty bad for translation, and allows the user to easily break the layout.
You have the following options:
1.a)
Joomla 2.5+ supports an article image and thumbnail that you can specify in the Images and Links group for each article. Quite some work to extend to 3 images, you would need to write a plugin (or do a nasty core hack) and override the view; also it's not well documented. There is a discussion here about it: Add additional images to articles in Joomla 2.5
1.b)
Add the extra images as above with the plugin. Then use a module for displaying the images instead of the view override.
1.c)
Use a custom image management solution to link images to an article, then a plugin to display them. Easier, but still a lot of work. I have done this on one site and worked fine, although I would change a lot of code now. As far as I know there are no extensions available that will do this.
All three solutions allow you to use proper floating of the contents using divs floats responsive as appropriate, and will isolate the layout of the content from the images, thus obtaining a solid environment for the content editors, and easy translation (although, if you go with 1.a) or 1.b), I strongly advise you to use a proper translation suite such as Falang or JoomFish (Falang is a different port of Joomfish from the old 1.5 version)
2)
You will address this as above, with a module.
Create in your template a main
<div class="content-box">
<div class="content-main"> here you will place your component's output.</div>
<div class="content-sidebar"> here you will output a new module position, name it "article-sidebar"</div>
Then style it like this:
div.content-box {
/* here you need a clearfix choose one here: https://stackoverflow.com/questions/211383/which-method-of-clearfix-is-best/211467#211467 */
}
div.content-box div.content-main {
width:70%;display:inline-block;float:left;
}
div.content-box div.content-sidebar {
width:29.99%;float:right;
}
div.content-wide div.content-sidebar {
display:none;
}
But you may not want this on all pages, then you can deal with it programmatically when generating the template.
The idea is: in your template output, where you are writing
<div class="content-box">
instead add a class conditionally when your article-sidebar contains something:
<div class="content-<?php
if ($this->countModules("article-sidebar")==0)
echo "wide";
else
echo "box";
?>">
This will dinamically change the class of the div, so you only serve 1 css.
At this point, create a module and choose to display it "Only on selected pages" .
3)
When you want to change a view, never change the file in place. Instead copy all the view's php to a folder under your template's folder / html/com_contact/contact. Even if you're changing a different layout, you will still need to copy there the default.php.
Then change it inserting the google maps.
A final consideration. You should refrain from editing core files. Joomla sometimes issues security updates, and applying them will be painful. Good luck with your site.

Creating tabs using HTML and loading different content, for click of each tab

I need to create tabs on the webpage using html, and on click of each tab, need to load different content on the same page. Do let me know how to go about this, or any useful links that might help me.
Thanks,
Geetha
This can be done with jQuery and jQuery UI.
Here you can find some information about it. http://www.stilbuero.de/jquery/tabs_3/
Dojo (javascript framework) has a TabContainer. It's easy to implement, but depends on the content and how do you want to present it to the user.
You can start by looking here: Dojo TabContainer info
There's an example on that site which lets you see the html and javascript required to build a tabbed container.