Enjoy.....!
How to hide a dive on url change using jQuery
Example of using this method
Labels:
JQuery
How to redirect login user on desire page in wordpress
Copy this and paste this code in functions.php
<?php
add_filter('login_redirect', '_catch_login_error', 10, 3);
function _catch_login_error($redir1, $redir2, $wperr_user)
{
if(!is_wp_error($wperr_user) || !$wperr_user->get_error_code()) return $redir1;
switch($wperr_user->get_error_code())
{
case 'incorrect_password':
case 'empty_password':
case 'invalid_username':
default:
wp_redirect(site_url().'/home-page/?error='.$wperr_user->get_error_code());
}
return $redir1;
}
?>
Labels:
wordpress
how to make make shortcode of page/post in wordpress
Copy and paste this code in your function.php file
[postPage_include postidparam="1234"]
"1234" would be the WordPress ID of the Page you are
Method for use in post or page in template :-
echo do_shortcode( '[postPage_include postidparam="1234"]' );
<?php
function digwp_includeContentShortcode($atts) {
$thepostid = intval($atts[postidparam]);
$output = '';
query_posts("p=$thepostid&post_type=page");
if (have_posts()) : while (have_posts()) : the_post();
$output .= get_the_content($post->ID);
endwhile; else:
// failed, output nothing
endif;
wp_reset_query();
return $output;
}
// USAGE
/* In the post content, you can use
[postPage_include postidparam="1234"]
"1234" would be the WordPress ID of the Page you are
trying to include */
add_shortcode("postPage_include", "digwp_includeContentShortcode");
?>
Method for use in post or page in back-end :- [postPage_include postidparam="1234"]
"1234" would be the WordPress ID of the Page you are
Method for use in post or page in template :-
echo do_shortcode( '[postPage_include postidparam="1234"]' );
Labels:
wordpress
Create a custom widget and call it by using shortcode in wordpress
Copy code in functions.php
Now in Post/Page content, you can use the widget just by referencing it by name:
[widget widget_name="Your_Custom_Widget"]
enjoy!!
<?php
function widget($atts) {
global $wp_widget_factory;
extract(shortcode_atts(array(
'widget_name' => FALSE
), $atts));
$widget_name = wp_specialchars($widget_name);
if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')):
$wp_class = 'WP_Widget_'.ucwords(strtolower($class));
if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')):
return ''.sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"),''.$class.'').'
';
else:
$class = $wp_class;
endif;
endif;
ob_start();
the_widget($widget_name, $instance, array('widget_id'=>'arbitrary-instance-'.$id,
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
$output = ob_get_contents();
ob_end_clean();
return $output;
}
add_shortcode('widget','widget');
?>
Usage
Now in Post/Page content, you can use the widget just by referencing it by name:
[widget widget_name="Your_Custom_Widget"]
enjoy!!
Labels:
wordpress
use shortcodes within a WordPress Text widget
By default, WordPress shortcodes do not work within Text widgets. If you
need this functionality, it is quite easy to accomplish, simply follow
the steps below.
- Log into your WordPress Dashboard
- Under "Appearance" click "Editor"
- In the list of files on the right of the page, click "functions.php"
- At the bottom of the functions.php file, add the following code:
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');Click "Update File" and your shortcodes should now work in your Text widgets!
Labels:
wordpress
Subscribe to:
Comments (Atom)