Skip to content

Instantly share code, notes, and snippets.

View mdjwel's full-sized avatar
🎯
Focusing

Eh Jewel mdjwel

🎯
Focusing
View GitHub Profile
@mdjwel
mdjwel / GetRedirectURL.php
Created January 10, 2018 19:34
Get Redirect URL In PHP
<?php
/**
* get_redirect_url()
* Gets the address that the provided URL redirects to,
* or FALSE if there's no redirect.
*
* @param string $url
* @return string
*/
@mdjwel
mdjwel / creatSpanTag.php
Last active May 20, 2018 10:37
Convert a special sign to HTML Tag
<?php
function Convert_to_htmlTag($string, $tagSign='|') {
if(strpos($string, '|') == true) {
$firstSign = strpos($string, $tagSign);
$lastSign = strpos($string, $tagSign, $firstSign + 1);
$strArray = str_split($string);
$replaceSigns = array($firstSign => '<span>', $lastSign => '</span>');
$replaceSigns = array_replace($strArray, $replaceSigns);
echo implode($replaceSigns);
}else {
<?php
function prefix_tags($before = null, $sep = ', ', $after = '', $attr=[]) {
$html = '';
$tags = get_the_tags();
$tagItems = count($tags);
$i = 0;
if(is_array($attr)){
foreach ($attr as $name => $value) {
$attr = " $name=" . '"' . $value . '"';
@mdjwel
mdjwel / vc_custom_icon_font.php
Last active May 5, 2018 07:30
Visual composer custom icon font integration. Here I integrated the thimify icon package.
<?php
add_action( 'vc_before_init', function() {
if (class_exists('WPBMap')) {
add_filter('init', function () {
$param = WPBMap::getParam('vc_icon', 'type');
$param['value'][__('Thimify Icon', 'total')] = 'themify_icon';
vc_update_shortcode_param('vc_icon', $param);
}, 40);