Skip to content

Instantly share code, notes, and snippets.

View zakirsajib's full-sized avatar
💭
Looking for a new challenge in 2022!

Zakir Sajib zakirsajib

💭
Looking for a new challenge in 2022!
View GitHub Profile
@zakirsajib
zakirsajib / functions.php
Last active July 25, 2017 05:29
Display related post’s title within single post’s texts in same category. Actually insert the related post title after each 12, 17 and 25 paragraphs.
function my_post_list($title = 'Read More:', $args = array()){
global $post;
$project_category = wp_get_post_categories($post->ID);
$defaults = array( // Set some defaults for querying the Posts
'ignore_sticky_posts' => true,
'posts_per_page' => 1,
'post_status' => 'publish',
'category__in' => $project_category,
'orderby' => 'rand'
);
@zakirsajib
zakirsajib / airport-diagram.php
Created November 2, 2017 07:37
Tipton Airport Diagram/Map
<?php
/**
* Template Name: Airport Diagram
*
* @package tipton
*/
get_header('diagram');
get_sidebar();
?>
@zakirsajib
zakirsajib / Add class name in nav anchor
Last active December 13, 2017 09:12
WordPress Menu: HTML to WordPress Menu
// add class name 'scroll'- <li> <a href="#club" class="scroll">The Club</a></li>
function add_menuclass($ulclass) {
return preg_replace('/<a /', '<a class="scroll"', $ulclass);
}
add_filter('wp_nav_menu','add_menuclass');
@zakirsajib
zakirsajib / functions.php
Created March 1, 2018 07:02
Remove p tag and then Add " "
add_filter( 'the_content', 'wti_remove_autop_for_testimonial', 0 );
function wti_remove_autop_for_testimonial( $content )
{
global $post;
if ( $post->post_type == 'post' ){
remove_filter('the_content', 'wpautop');
$content = “ . $content. ”;
}
return $content;
}
@zakirsajib
zakirsajib / functions.php
Created March 1, 2018 07:03
Disable WordPress Events and News widget from the dashboard
function wp_remove() {
remove_meta_box( 'dashboard_primary', get_current_screen(), 'side' );
}
add_action( 'wp_network_dashboard_setup', 'wp_remove', 20 );
add_action( 'wp_user_dashboard_setup', 'wp_remove', 20 );
add_action( 'wp_dashboard_setup', 'wp_remove', 20 );
@zakirsajib
zakirsajib / functions.php
Created March 1, 2018 07:04
WooCommerce Rename Checkout Fields
add_filter( 'woocommerce_checkout_fields' , 'custom_rename_wc_checkout_fields', 10 );
function custom_rename_wc_checkout_fields( $fields ) {
$fields['billing']['billing_first_name']['placeholder'] = 'Indtast dit fornavn';
$fields['billing']['billing_first_name']['label'] = 'Fornavn';
$fields['billing']['billing_last_name']['placeholder'] = 'Indtast dit efternavn';
$fields['billing']['billing_last_name']['label'] = 'Efternavn';
$fields['billing']['billing_company']['placeholder'] = 'Firmanavn';
$fields['billing']['billing_company']['label'] = 'Firmanavn';
@zakirsajib
zakirsajib / functions.php
Created March 1, 2018 07:05
Rename the "Have a Coupon?" message on the checkout page
function woocommerce_rename_coupon_message_on_checkout() {
return 'Har du en kupon?' . ' <a href="#" class="showcoupon">' . __( 'Klik her for at indtaste din kode', 'woocommerce' ) . '</a>';
}
add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' );
@zakirsajib
zakirsajib / functions.php
Created March 1, 2018 07:06
Rename Woocommerce message, button
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Faktureringsdetaljer', 'woocommerce' );
break;
case 'Your order' :
$translated_text = __( 'Din bestilling', 'woocommerce' );
break;
case 'View cart' :
$translated_text = __( 'Se indkøbsvogn', 'woocommerce' );
@zakirsajib
zakirsajib / functions.php
Created March 1, 2018 07:13
Change the Login Logo
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url('https://xxx.com/wp-content/uploads/2017/11/logo-3.png');
width: auto;
height: 76px;
background-size: contain;
background-position: center center;
}
#login h1 a:focus,
@zakirsajib
zakirsajib / gist:2b0ce6c85acd0195672f549ce32a8813
Created March 1, 2018 11:22
Woocommerce product variations custom radio button
[type="radio"]:checked,
[type="radio"]:not(:checked) {
position: absolute;
left: -9999px;
}
[type="radio"]:checked + label,
[type="radio"]:not(:checked) + label
{
position: relative;
padding-left: 28px;