Skip to content

Instantly share code, notes, and snippets.

View techmuzz's full-sized avatar
👾
Always stay one step ahead of tech

TechMuzz techmuzz

👾
Always stay one step ahead of tech
View GitHub Profile
@techmuzz
techmuzz / functions.php
Last active January 3, 2021 19:02
Add a new BreadCrumb Into WooCommerce BreadCrumbs - https://techmuzz.com/how-to/wordpress/customize-woocommerce-breadcrumb/
add_filter('woocommerce_get_breadcrumb', 'addNewBreadcrumb');
function addNewBreadcrumb($crumbs)
{
array_splice($crumbs, 1, 0, [[__('New BreadCrumb'), home_url('/newbreadcrumb/')]]);
return $crumbs;
}
window.onload = function(){
setTimeout(function() {
var ad = document.querySelector("ins.adsbygoogle");
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
alert("Please don't use Ad blocker on this site.");
var x = document.createElement("IMG");
x.setAttribute("src", "https://www.techmuzz.com/wp-content/uploads/2018/12/stop-ad-blockers.png");
x.setAttribute("width", "750");
x.setAttribute("height", "415");
x.setAttribute("alt", "Please don't use Ad blocker for this site.");
function excludeCatTechMuzz($query){
if ( $query->is_home ) {
$query->set(‘cat’, ‘-1479’); //1479 is the category number
}
return $query;
}
add_filter(‘pre_get_posts’, ‘excludeCatTechMuzz’);
function custom_scripts_styles_mobile_responsive() {
wp_enqueue_script( 'beautiful-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_style( 'dashicons' );
}
add_action( 'wp_enqueue_scripts', 'custom_scripts_styles_mobile_responsive' );
<script>
$(function () {
var width = 0,
flipboard = document.getElementById('flipboard');
width = flipboard.getBoundingClientRect().width ? flipboard.getBoundingClientRect().width : flipboard.offsetWidth;
if (width > 800) {
flipboard.innerHTML = '<iframe width="100%" frameborder="0" height="600px" marginheight="0" marginwidth="0" scrolling="no" src="https://flipboard.com/section/the-internet-of-things-bn8l9H"></iframe>'
}
})();
</script>
<?php
class IXR_Value
{
var $data;
var $type;
function IXR_Value($data, $type = false)
{
$this->data = $data;
if (!$type) {
function techmuzz_navigation_links() {
if ( is_singular('post') ) { ?>
<div style="background: #eee; border: 1px solid #bbb;display:inline-block;padding:5px 10px 5px 10px;margin-bottom:10px;">
<span class="nav-previous alignleft" style="width:45%;">
<?php previous_post_link('<strong>%link</strong>', '<span style="color: #333;"><< Previous Post</span>', TRUE) ?><br/>
<?php previous_post_link('%link', '%title', TRUE) ?>
</span>
<span class="nav-next alignright" style="width:45%;">
<?php next_post_link('<strong>%link</strong>', '<span style="color: #333;">Next Post >></span>', TRUE) ?><br/>
<?php next_post_link('%link', '%title', TRUE)?>
function remove_archive_body_class( $classes ) {
if ( is_archive() ) {
foreach ( $classes as $key => $value ) {
if ( $value == 'archive' ) unset( $classes[$key] );
}
}
return $classes;
}
add_filter( 'body_class', 'remove_archive_body_class', 20, 2 );
function avatar_with_site_title() {
echo get_avatar( 'parth@techmuzz.com', 150 );
}
add_action( 'genesis_site_title', 'avatar_with_site_title', 0 );
function logo_with_title() {
$imageUrl = get_stylesheet_directory_uri() . '/images/site_logo.png';
printf( '<a href="%s"><img src="%s" /></a>', trailingslashit( home_url() ), $imageUrl );
}
add_action( 'genesis_site_title', 'logo_with_title', 0 );