Skip to content

Instantly share code, notes, and snippets.

@dungtd91
dungtd91 / Controller.php
Created June 11, 2022 05:27 — forked from ozin7/Controller.php
Drupal 8: Dependency injection in Service, Controller, Plugin, Deriver.
<?php
/**
* Controller. Implements ContainerInjectionInterface
*/
namespace Drupal\gurei\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\gurei\Service\CompanyService;
use Symfony\Component\DependencyInjection\ContainerInterface;
@dungtd91
dungtd91 / carousel-smooth-autoplay-owl-modified.markdown
Created May 7, 2019 11:33
Carousel Smooth autoplay (OWL MODIFIED)
@dungtd91
dungtd91 / editor-style.css
Created December 6, 2018 09:17 — forked from WPsites/editor-style.css
WordPress tinymce style dropdown
/*
editor styles
*/
.Bold{
font-weight:bold;
}
.Medium{

WP All Import - IF/ELSE statement examples

Here are some example WP All Import [IF] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use XPath functions. Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a PHP function as shown here.

Note: The [ELSE]<something> part is optional

Number is equal to:

[IF({price[.=0]})]Zero[ELSE]Not Zero[ENDIF]

@dungtd91
dungtd91 / functions.php
Created October 12, 2018 02:30 — forked from vishalbasnet23/functions.php
Append async to wp_enqueue_script
<?php
function advanced_asyc_scripts($url) {
if ( strpos( $url, '#asyncload') === false ) {
return $url;
} else if ( is_admin() ) {
return str_replace( '#asyncload', '', $url );
} else {
return str_replace( '#asyncload', '', $url )."' async='async' defer='defer";
}
}

Remove Trailing Slash From Magento URLs

Duplicate Content Issue

from http://www.example.com/category.html/ to http://www.example.com/category.html

Step 1

Go to ../app/code/core/Mage/Core/Block/Abstract.php copy this file to ../app/code/local/Mage/Core/Block/Abstract.php

Find the following line of code:

@dungtd91
dungtd91 / social_counts.inc.php
Created March 21, 2018 07:28 — forked from andrewspear/social_counts.inc.php
Count your Facebook followers, Twitter followers, Google+ followers, LinkedIn group followers, Constant Contact subscribers, YouTube subscribers, YouTube channel views.
<?
/*
$facebook_followers = social_count('facebook', array(
'id' => '<your_facebook_page_name_or_id>',
'api_key' => '<your_facebook_app_api_key>',
'api_secret' => '<your_facebook_app_api_secret>'
));
@dungtd91
dungtd91 / hnl.taphover.js
Created December 18, 2017 04:44 — forked from c-kick/hnl.taphover.js
jQuery - Mouse hover on touch devices
//taphover - a solution to the lack of hover on touch devices.
//more info: http://www.hnldesign.nl/work/code/mouseover-hover-on-touch-devices-using-jquery/
$('a.taphover').on('touchstart', function (e) {
'use strict'; //satisfy the code inspectors
var link = $(this); //preselect the link
if (link.hasClass('hover')) {
return true;
} else {
link.addClass('hover');
$('a.taphover').not(this).removeClass('hover');
@dungtd91
dungtd91 / SSLXampp.md
Created December 14, 2017 08:14 — forked from nguyenanhtu/SSLXampp.md
Guide to configure SSL in XAMPP for Windows

How to test 'https' in XAMPP for localhost ? I will guide you

Menu

  • Create certificate
  • Config Apache to access https instead of http
  • Config mod rewrite to generate SSL url
  • Config Virtual host to test site

Step 1 : Create certificate

  • Go to your XAMPP installation directory (in my case it’s E:\xampp), figure out apache folder. In this, find & run batch file
@dungtd91
dungtd91 / get-isotope-items.php
Created November 10, 2017 07:10 — forked from mohandere/get-isotope-items.php
jQuery isotope plugin for wordpress posts filtering by category with pagination.
<?php
function get_isotope_item( $query_args = array() ){
$defaults = array(
'post_type' => 'post',
'posts_per_page' => -1,
'post_status' => 'publish',
);