How to put a widget in a page - wordpress

I am new to wordpress and I am trying to figure out how menus relate to widgets. Is there a way I can add a widget to a page? Not on the side bar but in the page.

Not easily, I'm afraid :( However, a 'sidebar' in WordPress can be any container in your website. It does not necessarily need to be on the side of your page. You can use register_sidebar() in your functions.php file to create a new sidebar, then simply display the widgets in your new sidebar with dynamic_sidebar(). It's your CSS that places the sidebar on the side of your page. If you look at it that way, you can instead use CSS to make a horizontal 'sidebar' for instance. The name 'sidebar' will most likely change at some point in the future to better reflect that.

Related

What is the difference between wordpress widgets and block

I have started learning wordpress recently. I have started from version 5 with this new Gutenberg editor which introduced Blocks. I am little confused regarding difference between this new Blocks concept and old Widgets.
Starting with a Blocks: they appear on page creation and can be added to page, there is nice documentation on wordpress webpage: https://developer.wordpress.org/block-editor/tutorials/block-tutorial/ a lot of stuff related to new blocks.
Everything is fine, but Blocks can be added only to page content and not into areas like: sidebar, footer etc.
For changing content of sidebar,footer areas we need to access Appearance->Widgets area where we can add multiple widgets to specific areas. Also for new Gutenberd Page Builder there is section called widgets available but with less number of widgets than under
Apperance->Widgets section.
Im totally confused. Could someone explain what is the difference betweemn Blocks and Widgets?
Why for areas like sidebar/footer we can add only widgets and editing footer is under Widgets menu?
Why only part of widgets are available for Gutenberg Page Editor
What should i do to create reusable code snippet(some html/css/js logic) to be reused on a page? Should i create a widget and somehow include it to widget section for Gutenberg or maybe i should create this new concept of Block? But i will not reuse my block in footer/sidebar section...
Are widgets something which will gonna die soon in wordpress world and will be totally replaced by Blocks? I remember that in previous version we were able to add widgets to page using some kind of shortcodes, so any widget we want? Is it still possible?.
I will appreciate any comments on that.
The Block Editor is so far being used only to generate "content". In the world of WordPress, that normally very generic word has a very specific meaning: whatever is returned by the function the_content(). Usually it's simply all the text and media input on the edit page of a post or page, though that can be modified by filters. This content is entered either in the classic editor's text box or (now) in one or more Gutenberg Blocks.
Widgets, on the other hand, display content outside the main content, in widget areas that your theme has located outside the main content in headers, sidebars, footers, etc.
I suspect you already know much of this. As to your question about code snippets, the simplest way to re-use code is through WordPress shortcodes. Register your shortcodes in functions.php or in a plugin; enable them in your theme; then use them anywhere. There is now a shortcode Block, by the way, for placing recurring content into main content.

Add widget to the middle of a Wordpress page

I am working on a blog at www.tosreport.com/scripting and might want to adjust where I place certain items such as the shoutbox plug-in on the right hand side of the page. Apparently, the only 'widget areas' are sidebar and footer. Is it possible to place a widget in the body of a page or even in the body of a particular post?
Of course, you just have to register another sidebar widget area:
http://codex.wordpress.org/Function_Reference/register_sidebar
And then, place on index.php or loop.php depends on your theme layout:
Check this code, this is an example of what you need, placing the previous code in the "ad" code:
https://stackoverflow.com/a/7001372/1478479

Is it possible to have a large image above the content node in Drupal?

I'm trying to replicate pages like the following using Drupal:
http://www.ams-neve.com/Products/Outboard/1073LB/1073LB.aspx
My problem is that I'd like the image at the top (which changes depending on which page you're on) to be part of the main content node, while the menu on the left is a sidebar region.
I'd like to have a 'product' content type where I can write the main copy, include linked files, etc. plus have a 'header image' which would be what appears at the top of the page.
I have the feeling that it can't be done like this because I'd essentially need bits of the node to be rendered into different blocks. If I theme the node template to wrap a div around the header image I can't figure out a way to have that moved to the top of the page and displace the left sidebar down.
Can anyone tell me if it's possible, or suggest an alternative route.
There are a lot of products so I need it to be a simple method.
The method I used was to create a Views Slideshow Block in Views. It pulled the header_image field from my node by looking at the page it was on. I put this block into the header of my page.
Anyone else looking at this should also check out Display Suite. You can do a lot of cool stuff with that.
if i'm not getting it wrong you are having problems with the default way in which drupal blocks work. Have you tried panels? It's an awesome plugin to work with drupal which let you create pages in a really flexible way.
You could have a custom field for your 'Product' content type that is an image or a text field to a URL for the header image. Just use CSS to place them where you'd like.
Alternatively, check out these links, I think they are what you are looking for.
http://drupal.org/project/headerimage
http://drupal.org/project/sections

Making Room for Second Sidebar

I have the screwdriver wordpress theme installed on my site (http://wordpress.org/extend/themes/screwdriver)
I made the necessary changes to my functions.php file, then created a sidebar-custom.php file, and now the new sidebar is showing up in my Wordpress account, but I was told that I now need to create space for the new sidebar in the theme layout.
I am told it takes a lot of layout redesign. Can anyone point me in the right direction on how to accomplish this? I want the newly-added sidebar to appear on the right side of page.
Looking at what I have, I'm assuming that I'll need to extend the width of gray field that shows in the back of my theme, then move the center "plate" where my posts reside, along with the "plates" on the left that hold the widgets. Then, I need to set the coding so that
My issue is, I don't know where to begin doing this. Can someone point me in the right direction?
Am I correct in assuming that this change will need to be made in the index.php file?
Well it could depend on how you registered the sidebar, but...
Go into your theme folder and locate the best place to put it (perhaps at the bottom of header.php ?)
<?php dynamic_sidebar('yoursidebarname'); ?>
Refresh your site, find the CSS selector for the new sidebar, and modify style.css accordingly - you might want to float it to the right and resize the content area.
I'm not familiar with the Screwdriver theme so this may be totally wrong.

Different sidebars for each Wordpress page

I'm making a Wordpress 2.9.2 theme, and I'd like each page to have its own sidebar than can be edited as easily as the page's content. It would be cumbersome to make a different template file for each sidebar. It would also be weird to add a "custom field" containing all the sidebar text, since I wouldn't be able to use the Visual/HTML editor. What I'd like is to have a tag similar to the tag, but instead of delimiting the content to be shown on the front page, it would split the post's content and sidebar. Is this possible? Or is there a better solution?
Make the sidebars widgetized and than use the widget logic plugin, so you can conditionally include widgets on any and all pages.
Doing this lets you utilize the out of the box widgets, which are awesome, and even integrated third party widgets that are just as great.
Also consider this: You widgetize other areas of your site, like your header, which can now use widgets and widget logic. This makes for a more flexible theme.

Resources