Skip to content

Instantly share code, notes, and snippets.

View mlbd's full-sized avatar
🏠
Working from home

Mohammad Limon mlbd

🏠
Working from home
View GitHub Profile
# PHP 5.3+ anonymous function
add_action( 'widgets_init', function() {
register_widget( 'Sample_Widget_SO_19246434' );
});
class Sample_Widget_SO_19246434 extends WP_Widget
{
function __construct() {
parent::__construct(
/**
* Custom excerpt
*
* @since 1.0
*
* @uses get_queried_object()
*
* @see get_the_ID()
*
/**
* Social Share buttons
*/
if ( !class_exists( 'Pixiefy_Social_Btns' ) ) {
class Pixiefy_Social_Btns {
public $args = '';
public function __construct($args){
$this->args = $args;
var $header_menu_link = $('.appmax-header-menu ul li a');
if ($header_menu_link.is_exist()) {
$header_menu_link.on('click', function(e){
var href = $(this).attr("href");
if (/#/.test(this.href)) {
if ( $(href).length ) {
var minus = 100;
var offsetTop = href === "#" ? 0 : $(href).offset().top - minus;
function eduprime_get_nested_events()
{
// get the meta
$event_posts = get_posts(array('post_type' => 'tp_event', 'posts_per_page' => -1));
if( ! $event_posts ) return '';
$status_meta = array();
foreach ($event_posts as $single ) {
$meta = get_post_meta( $single->ID, 'tp_event_status', true );
/**
*
* Import Class
* A helper class for support CS to OCDI
*
*/
if ( !class_exists( 'OCDI_Plugin' ) )
return;
.curex-hero-thumb {
position: absolute;
left: calc((-100vw + 100%) / 2);
right: calc((-100vw + 100%) / 2);
height: 100%;
}
String.prototype.getValueByKey = function(k){
var p = new RegExp('\\b'+k+'\\b','gi');
return this.search(p) != -1 ? decodeURIComponent(this.substr(this.search(p)+k.length+1).substr(0,this.substr(this.search(p)+k.length+1).search(/(&|;|$)/))) : "";
};
@mlbd
mlbd / Create a post with contact form 7 (wpcf7)
Created July 7, 2018 04:34
Create a post automatically with contact form 7 submission
add_action( 'wpcf7_before_send_mail', 'fordwich_create_post_after_cf7' );
/**
* Do stuff for my contact form form. This function shouldn't return aything
*
* @param WPCF7_ContactForm $contact_form wpcf7 object, passed by refference
*/
function fordwich_create_post_after_cf7( $WPCF7_ContactForm ) {
var mySwiper = new Swiper('.swiper-container', {
slidesPerView: 5,
spaceBetween: 30,
loop: true,
centeredSlides: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
on: {