Skip to content

Instantly share code, notes, and snippets.

@pradeepdotco
pradeepdotco / disable-wordpress-search.php
Created November 9, 2015 22:12
Disable WordPress Search
function fb_filter_query( $query, $error = true ) {
if ( is_search() ) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;
// to error
if ( $error == true )
$query->is_404 = true;
=== Plugin Name ===
Contributors: (this should be a list of wordpress.org userid's)
Donate link: https://example.com/
Tags: tag1, tag2
Requires at least: 4.7
Tested up to: 5.4
Stable tag: 4.3
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@pradeepdotco
pradeepdotco / alexa widget
Created October 14, 2015 19:32
Alexa Widget to show show Website Rank
<a href="http://www.alexa.com/siteinfo/wpism.com"><script type="text/javascript" src="http://xslt.alexa.com/site_stats/js/t/a?url=wpism.com"></script></a>
@pradeepdotco
pradeepdotco / post-edit-button.php
Created November 9, 2015 21:49
Post Edit Button
<?php edit_post_link(__('{Quick Edit}'), ''); ?>
@pradeepdotco
pradeepdotco / rssfeedimage.php
Created October 3, 2015 10:54
Function to add featured image to RSS feed
<?php
add_filter( 'the_content', 'featured_image_in_feed' );
function featured_image_in_feed( $content ) {
global $post;
if( is_feed() ) {
if ( has_post_thumbnail( $post->ID ) ){
$output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
$content = $output . $content;
}
}
@pradeepdotco
pradeepdotco / functions.php
Last active May 26, 2022 23:41
Add Featured Image Genesis
/* Code to Display Featured Image on top of the post */
add_action( 'genesis_before_entry', 'featured_post_image', 8 );
function featured_post_image() {
if ( ! is_singular( 'post' ) ) return;
the_post_thumbnail('post-image');
}
@pradeepdotco
pradeepdotco / Google-Tag-Manager-Genesis-Code
Last active January 4, 2022 21:55
Google Tag Manager for Genesis Theme
/**
Add Google Tag Manager script on Genesis Framework
**/
add_action('genesis_before', 'google_tag_manager');
function google_tag_manager() { ?>
<!-- Google Tag Manager -->
ADD YOUR GOOGLE TAG MANAGER CODE HERE
<!-- End Google Tag Manager -->
<?php
@pradeepdotco
pradeepdotco / social-media-widget-jetpack.css
Created November 7, 2017 11:30
Social media icons Jetpack widget
.widget_wpcom_social_media_icons_widget .genericon {
font-size: 16px;
}
@pradeepdotco
pradeepdotco / featured-image-link.php
Created May 6, 2020 15:48
Adding Link to the featured Image - Genesis
@pradeepdotco
pradeepdotco / .htaccess
Created December 3, 2015 17:47
Redirect 301 old website to a new website with .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>