wordpress plugin installation - wordpress

I am learning wordpress. Now I want to install a simple photo gallery plugin. For that I have downloaded plugin from internet. Now how to integrate that so that I can find from the front-end in a particular position.
Thank you.

Your theme should have specific areas to put the plugins in.
If not You should open the php file of the template that you want to display the plugin in and add this code:
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Your plugin name') ) :
endif;
Now, open your functions.php and add this:
if ( function_exists('register_sidebar') ) {
register_sidebar( array(
'name' => 'Your plugin name',
'id' => 'login-widget',
'before_widget' => '<section class="login-widget">',
'after_widget' => '</section>',
'before_title' => '<span class="widget-title">',
'after_title' => '</span>')
);
}
after you are done with that, you can go to your administrator page, click on Appearance -> Widgets and then drag the plugin name from the list to the dock named "Your plugin name"

Related

Wordpress - display widget

I'm creating a custom theme and in my contact page i want to add a widget to display google maps map throught Wp Google Map plugin but i can't show the map in my page.
In my functions.php i have this:
function arphabet_widgets_init() {
register_sidebar(array(
'name' => 'My_Widgtet_Area',
'id' => 'map-area',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
));
}
In my html file:
<?php
$map = get_page_by_title( 'Mapa' );
echo $map->post_content;
?>
In my page content:
[wpgmza id="1"]
How can i display or associate the widget to my page?
Thank's
You can add the map directly using the given shortcode or you can add the shortcode in the widget and add the widget in page.
To add the map directly in the page using shortcode
echo do_shortcode('[wpgmza id="1"]');
To add widget in the page
dynamic_sidebar('map-area');
Hope it helps...
Please ask if you have any doubts.

activate plugins on custom theme

I'm new to Wordpress and just created my first template.
In the functions.php I have put the following code, that function what I understand should call the plugins from the plugins directory:
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Widgetized Area',
'id' => 'widgetized-area',
'description' => '',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
}
I do see all the plugins, and in the widget screen I also see the 'widgets' screen and it allows me to drag widgets into the working area.
The website itself displays the plugin's html but neither js nor css is working.
What am I missing?
Above code that you have added in your functions.php is to register sidebar not to call any plugin. It do not have any connection to plugin.
You can call sidebar you added in template as follow:
if ( is_active_sidebar( 'widgetized-area' ) ) {
dynamic_sidebar( 'widgetized-area' );
}

Wordpress admin option for users to select custom Sidebar widgets per page

First of all, I have created sidebars on the widget panel:
add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
register_sidebar(
array(
'id' => 'sidebar1',
'name' => __( 'Sidebar1' ),
'description' => __( 'The Sidebar 1.' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
)
);
I have created a number of custom sidebar layouts. I want each of these layouts to be it's own widget, as an option like the default wordpress ones (e.g. archives, calendar, RSS, Search, Tag Cloud etc). So I can select which ones I want available for every site created.
Then depending on which sidebars I have made available I want the option for users (when creating / editing a page) to be able to choose from a dropdown sidebar options box, which layout they want on the relevant page - So this can then be called dynamically instead of having to call each layout specifically myself:
get_sidebar('$user-selected');
Apologies for waffling a bit, but any help is appreciated.
(p.s. I want to avoid using plugins)
Thanks, Matt.
Just use a custom field with a select box which displays all the available sidebars.
Then in your page template check for the custom field value and output accordingly.

Adding widget area to functions.php causes blank screen after posting anything in admin

I'm following multiple tutorials that all tell me to put this into my functions.php to add a widget area:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '<div class="title">',
'after_title' => '</div>',
));
?>
Once I upload that file and try to change anything, like post or edit a post I get a white screen directly after hitting publish or any other action button.
Is there something wrong with that code? Or am I missing something when it comes to adding widget areas to my template?
Wordpress doesn't like blank lines on the functions.php page..

WordPress 3 - functions.php Queries

I'm new to WordPress theming and have downloaded the Starker's WP theme from starkers
My question is, as this is an updated theme based on new twentyten for WordPress 3.0, do I need all the code in the functions.php file as it all seems to make reference to default twentyten theme?
I'm am doing a CMS and was wondering if there is any important code I need in this functions.php file?
Thanks.
It depends on what stuff you are going to incorporate in your theme. You don't need that all unless you want.
The minimum you need is for sidebar integration, here is an example:
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<div class="side">',
'after_widget' => '</div></div>',
'before_title' => '<div class="sidebar_title">',
'after_title' => '</div><div class="side_content">',
));
This is usually helpful when you want to assign what should come before or after the sidebar.
For example, I created a theme using Starker's theme and here is all what is present in my functions.php file:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<div class="side">',
'after_widget' => '</div></div>',
'before_title' => '<div class="sidebar_title">',
'after_title' => '</div><div class="side_content">',
));
// add thumbnail support to theme, options will be automatically visible in admin
if (function_exists('add_theme_support')) add_theme_support( 'post-thumbnails' );
?>

Resources