Skip to content

Instantly share code, notes, and snippets.

View tojibon's full-sized avatar
:octocat:
Finalizing

Juyal Ahmed tojibon

:octocat:
Finalizing
View GitHub Profile
@tojibon
tojibon / wp-admin-page-template-selection.js
Last active August 29, 2015 14:07
Loading Show/Hide different settings meta block for Page, Post, Post Type (i.e : Portfolio) when page template changed on WordPress admin by a Javascript which is loaded for admin
/*
---------------------------------------------------------------------------------------
Loading different settings meta block for Page, Post, Portfolio when page template changed on WordPress admin
---------------------------------------------------------------------------------------
*/
jQuery(document).ready( function($) {
/*
@tojibon
tojibon / wp-unique-page-sidebar-autofill.js
Last active August 29, 2015 14:07
Auto fill input values for WordPress Unique Page Sidebars [Plugins] when creating a dynamic sidebar with default values
/*
---------------------------------------------------------------------------------------
Auto fill input values for WordPress Unique Page Sidebars [Plugins] when creating a dynamic sidebar with default values
---------------------------------------------------------------------------------------
*/
jQuery(document).ready( function($) {
//Finding all inputs from unique page sidebars when creating a sidebar
$("input[id^=ups_sidebars]").each( function( k, v ) {
@tojibon
tojibon / wp-contact-form-7-style.css
Last active August 29, 2015 14:07
WordPress Contact form 7 [Plugins] Nice css3 styles
/*Contact Form 7 CSS Support*/
span.wpcf7-not-valid-tip{display: none !important; }
div.wpcf7 .wpcf7-not-valid{ border: 1px solid #F00; margin: 0; }
div.wpcf7-validation-errors{ -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ -moz-box-sizing: border-box; /* Firefox, other Gecko */ box-sizing: border-box; /* Opera/IE 8+ */ margin: 0; padding: 10px; color: #c4690e; background: #fffdf3; text-align: center; border: 1px solid #e6bf4a; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; font-size: 12px;}
div.wpcf7 .wpcf7-not-valid { box-shadow: 0 0 6px rgba(255,0,0,0.4); }
.your-message textarea{ width:100%; -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ -moz-box-sizing: border-box; /* Firefox, other Gecko */ box-sizing: border-box; /* Opera/IE 8+ */ }
div.wpcf7-mail-sent-ok { -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ -moz-box-sizing: border-box; /* Firefox, other Gecko */ box-sizing: border-box; /*
@tojibon
tojibon / wp-featured-image-upload-for-front-end.php
Last active February 21, 2018 03:48
Upload featured image on custom post from WordPress front-end
@tojibon
tojibon / wp-replace-post-image-uri.php
Last active August 29, 2015 14:07
Replacing media urls on WordPress
<?php
/*
When you are done with all development and uploaded all contents on a development setup that means all media files and
contents media urls are targeting with http://www.example.com/dev your development site.
You can replace all resource and post links to your live site with below written codes in php.
You just need to execute the code with wp query.
Author: Jewel Ahmed
Author Url: http:www.codeatomic.com
*/
@tojibon
tojibon / wp-open-graph.php
Last active August 29, 2015 14:07
Adding Open Graph Content on WordPress
<?php
if ( !function_exists( 'mondira_add_opengraph' ) ) {
function mondira_add_opengraph() {
global $post;
if ( empty( $post ) ) {
return "";
}
echo "\n<!-- " . get_bloginfo( 'name' ) . " Open Graph Tags -->\n";
@tojibon
tojibon / get_previous_next_post.php
Last active August 29, 2015 14:08
If you are using menu order for CTP post index and viewing single then you can use this snippets to get the right post link for next/prev.
<?php
function mondira_previous_post_where( $in_same_term, $excluded_terms ) {
global $post, $wpdb;
if ( get_post_type( $post ) == 'portfolio' ) {
return $wpdb->prepare( "WHERE p.menu_order < %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_terms_sql", $post->menu_order, $post->post_type);
}
}
add_filter( 'get_previous_post_where', 'mondira_previous_post_where', 10, 2 );
function mondira_next_post_where( $in_same_term, $excluded_terms ) {
@tojibon
tojibon / gist:aefa3f66bf1c83fc74b9
Last active August 29, 2015 14:09
wordpress-tb-menu.php
<?php
/*
*
* WordPress menu building THIS IS valid till you have a menu created by admin.
*
* Author: Jewel Ahmed
* Author Web: http://codeatomic.com
* Last Updated: 09 Nov, 2014
*/
$has_enabled_main_menu = false;
@tojibon
tojibon / tb-wp-menu-walker.php
Last active August 29, 2015 14:09
Twitter Botstrap Dropdown Navigation vs WordPress
<?php
/*
*
* Adding bootstrap support on menu items by menu walker.
*
* @Author: Jewel Ahmed
* @Author Web: http://codeatomic.com
* @Last Updated: 14 Oct, 2014
*/
if ( !class_exists( 'Mondira_Bootstrap_Walker' ) ) {
@tojibon
tojibon / functions.php
Last active August 29, 2015 14:18
WordPress child theme stylesheets enqueue
add_action( 'wp_enqueue_scripts', 'mondira_child_theme_css' );
function mondira_child_theme_css() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_uri(), array( 'parent-style' ) );
}