Skip to content

Instantly share code, notes, and snippets.

View manchumahara's full-sized avatar
💭
Life is beautiful!

Sabuj Kundu manchumahara

💭
Life is beautiful!
View GitHub Profile
@manchumahara
manchumahara / gist:6ee3f5e9ea1e63f9df09f03e475810fb
Created December 10, 2018 13:21
cbx single criteria rating integration
if ( function_exists( 'cbxscratingreview_postAvgRatingInfo' ) )
{
echo cbxscratingreview_postAvgRatingRender( get_the_ID() );
}
if(function_exists('cbxscratingreview_reviewformRender')){
echo cbxscratingreview_reviewformRender();
}
if ( function_exists( 'cbxscratingreview_postReviewsRender' ) )
<?php
/**
* @package Joomla.Plugin
* @subpackage System.CBXDebug
*
* @copyright Copyright (C) 2018 Codeboxr.com. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
//category doesn't show as admin column
$cat_args = apply_filters('', array(
'hierarchical' => true,
'label' => esc_html__('Categories', 'cbxgooglemappro'),
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'cbxgooglemapcat' ),
'singular_label' => esc_html__('Categories', 'cbxgooglemappro')
));
register_taxonomy( 'cbxgooglemapcat', array( 'cbxgooglemap' ), $cat_args );
/**
* Setup a post object and store the original loop item so we can reset it later
*
* @param obj $post_to_setup The post that we want to use from our custom loop
*/
function setup_admin_postdata( $post_to_setup ) {
//only on the admin side
if ( is_admin() ) {
@manchumahara
manchumahara / authorarchive_snippet.php
Created October 22, 2018 06:21
How to get author archive url in joomla using CBX Author Archive component https://codeboxr.com/product/cbx-author-post-archive-for-joomla/
if(JComponentHelper::isEnabled('com_authorposts', true)){
$author_id = ''; //set author archive here
require_once JPATH_SITE . '/components/com_authorposts/helpers/route.php';
$author_archive_link = AuthorpostsHelperRoute::getAuthorRoute($author_id, $language = 0);
}
if(JComponentHelper::isEnabled('com_authorposts', true)){
$author_id = ''; //set author id here
require_once JPATH_SITE . '/components/com_authorposts/helpers/route.php';
$author_archive_link = AuthorpostsHelperRoute::getAuthorRoute($author_id, $language = 0);
}
@manchumahara
manchumahara / custom_embed.php
Last active October 21, 2018 10:47
Embed in WordPress Outside of Editor or Content https://manchumahara.com/?p=1135&preview=true
$url = 'https://www.youtube.com/watch?v=08f0tiLdk7w'; //a youtube video url
$autoembed = new WP_Embed(); //initialize the wordpress oEmbed helper class
$content = $autoembed->autoembed($url); //let's parse the url and get the embeded content
//put this code in functions.php
if ( ! function_exists( 'interested_in_product' ) ) {
/**
* Returns url that takes to contact page with product or product with variation selected
*
* @param int $page_id page id where the contact form is added
* @param string $product_id main product id
* @param string $variation_id variation, you should put product id if you want to add variation id
*
* @return string
/**
* Is the frontpage a page ?
*
* @return bool
*/
function is_frontpage_is_page(){
if('page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && is_page( get_option( 'page_on_front' ) )) return true;
return false;
}
@manchumahara
manchumahara / gist:38336907d35012a2233d9ce6f01a777e
Created September 11, 2018 10:10
less mixin for placeholder color
.placeholdercolor(@color, @opacity: 1){
&::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: @color !important;
opacity: @opacity;
}
&::-moz-placeholder { /* Firefox 19+ */
color: @color !important;
opacity: @opacity;
}
&:-ms-input-placeholder { /* IE 10+ */