Skip to content

Instantly share code, notes, and snippets.

View stalukder03's full-sized avatar

Sajib Talukder stalukder03

View GitHub Profile
@media screen and (min-width: 1281px) {
//CSS
}
@stalukder03
stalukder03 / wp-get-image-alt-text.php
Created July 4, 2018 18:24 — forked from patrickgilmour/wp-get-image-alt-text.php
WordPress Images - echo the Alt text of the Featured image (and other image attributes)
<?php
/**
* Get the Alt text of a Featured Image
*
* And other image attributes
*/
add_action('genesis_before_sidebar_widget_area', 'pgwp_genesis_before_sidebar_widget_area' );
function pgwp_genesis_before_sidebar_widget_area () {
@stalukder03
stalukder03 / custom_excerpt_wp.php
Created June 11, 2018 16:03 — forked from sammdec/custom_excerpt_wp.php
Wordpress Custom Excerpt function
<?php
function get_excerpt($count, $post_id){
$permalink = get_permalink($post_id);
$excerpt = get_post($post_id);
$excerpt = $excerpt->post_content;
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $count);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = $excerpt;
// Want a read more link and ellipsis, remove the line above this and replace it with the one below.
@stalukder03
stalukder03 / functions.php
Created June 11, 2018 11:34 — forked from jaredatch/functions.php
WordPress Search Autocomplete using admin-ajax.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@stalukder03
stalukder03 / functions.php
Created June 11, 2018 11:34 — forked from jaredatch/functions.php
WordPress Search Autocomplete using WP REST API v2
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@stalukder03
stalukder03 / awesome-support-custom-fields.php
Created June 7, 2018 09:33 — forked from julien731/awesome-support-custom-fields.php
Awesome Support Custom Fields Starter Kit
<?php
/**
* @package Awesome Support/Custom Fields
* @author ThemeAvenue <web@themeavenue.net>
* @license GPL-2.0+
* @link http://themeavenue.net
* @copyright 2014 ThemeAvenue
*
* @wordpress-plugin
* Plugin Name: Awesome Support: My Custom Fields
@stalukder03
stalukder03 / custom-domain-localhost-xampp
Created June 6, 2018 07:09 — forked from oozman/custom-domain-localhost-xampp
How to add a custom domain name on your localhost using XAMPP. Codes are based on Windows, but Step 2 onwards are pretty much applicable on other operating system.
Step 1:
Go to: C:\Windows\System32\Drivers\etc\hosts
And add this to the bottom of the file:
=============
127.0.0.1 your.domain.com
=============
Step 2:
Go to [your XAMPP directory]/apache/conf/httpd-xampp.conf
@stalukder03
stalukder03 / class-wp-numeric-pagination.php
Created April 21, 2018 03:04 — forked from pixeline/class-wp-numeric-pagination.php
Wordpress Numeric Pagination Class that enables you to set the classes of each LI and A html tag.
<?php
/**
* Numeric Pagination Class
* @author Alexandre Plennevaux https://pixeline.be
*
* This class returns a list of LI > A. It is up to you to set the wrapping NAV > UL around your function call.
*
* @usage (setting specific classes)
*
* // Sets the css classes you want to be used for the output
@stalukder03
stalukder03 / creatSpanTag.php
Created December 28, 2017 07:46 — forked from mdjwel/creatSpanTag.php
Convert a special sign to HTML Tag
<?php
function Convert_to_htmlTag($string, $tagSign='|') {
$firstSign = strpos($string, $tagSign);
$lastSign = strpos($string, $tagSign, $firstSign+1);
$strArray = str_split($string);
$replaceSigns = array($firstSign=>'<span class="se-s-color">', $lastSign=>'</span>');
$replaceSigns = array_replace($strArray, $replaceSigns);
echo implode($replaceSigns);
}
/**
* Escape translated strings with:
*/
__( ‘Hello world’, ‘text-domain’ ); _e( ‘Hello world’, ‘text-domain’ );.
/**
* If there is no HTML use:
*/
esc_html__( ‘Hello world’, ‘text-domain’ ); esc_html_e( ‘Hello world’, ‘text-domain’ );