Skip to content

Instantly share code, notes, and snippets.

View aryanrajseo's full-sized avatar

Aryan Raj aryanrajseo

View GitHub Profile
@aryanrajseo
aryanrajseo / author reviewer.php
Created September 23, 2023 22:37
author reviewer.php
function reviewed_by_helper() {
$author_id = get_field('reviewed_by');
// Check if the author has published posts
$author_has_posts = false;
if ($author_id) {
$author_has_posts = get_posts(array(
'author' => $author_id,
'posts_per_page' => 1, // Check for at least 1 post
'post_type' => 'post', // Adjust post type if needed
/* Universal styles for elements inside .gform_wrapper.gravity-theme */
#shortcode-292-1156 .gform_wrapper.gravity-theme * {
width: 100%;
}
/* Form container styles */
#shortcode-292-1156 .gform_wrapper form {
display: flex;
flex-direction: row;
@aryanrajseo
aryanrajseo / gpt3-loadmore.txt
Last active April 26, 2023 18:15
gpt loadmore
function load_more_scripts() {
wp_enqueue_script( 'loadmore', get_stylesheet_directory_uri() . '/js/loadmore.js', array('jquery'), '1.0', true );
wp_localize_script( 'loadmore', 'loadmore_params', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'posts' => json_encode( $args ),
'current_page' => get_query_var( 'paged' ) ? get_query_var('paged') : 1,
'max_page' => $query->max_num_pages
) );
}
@aryanrajseo
aryanrajseo / wp-query-ref.php
Created August 21, 2019 15:41 — forked from luetkemj/wp-query-ref.php
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@aryanrajseo
aryanrajseo / customizer-additional-js.php
Created July 18, 2018 11:54 — forked from seothemes/customizer-additional-js.php
Adds an Additional JS control to the Customizer and outputs the JS in the site footer.
<?php
/**
* Additional JS Customizer Control
*
* @author Lee Anthony
* @link https://seothemes.com
* @copyright Copyright © 2018 SEO Themes
* @license GPL-2.0-or-later
*/
@aryanrajseo
aryanrajseo / remove-empty-p.php
Created April 16, 2018 11:52 — forked from ninnypants/remove-empty-p.php
Remove empty p tags from WordPress posts
<?php
add_filter( 'the_content', 'remove_empty_p', 20, 1 );
function remove_empty_p( $content ){
// clean up p tags around block elements
$content = preg_replace( array(
'#<p>\s*<(div|aside|section|article|header|footer)#',
'#</(div|aside|section|article|header|footer)>\s*</p>#',
'#</(div|aside|section|article|header|footer)>\s*<br ?/?>#',
'#<(div|aside|section|article|header|footer)(.*?)>\s*</p>#',
'#<p>\s*</(div|aside|section|article|header|footer)#',
@aryanrajseo
aryanrajseo / featured-post-widget-modified-order.diff
Created March 29, 2018 04:36 — forked from damiencarbery/featured-post-widget-modified-order.diff
Tweak the Genesis Featured Posts Widget to allow for order by Date Modified.
--- lib/widgets/featured-post-widget.orig.php 2017-09-27 20:26:32.000000000 +0100
+++ lib/widgets/featured-post-widget.php 2017-10-25 13:31:33.705167000 +0100
@@ -430,6 +430,7 @@
<label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php _e( 'Order By', 'genesis' ); ?>:</label>
<select id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>">
<option value="date" <?php selected( 'date', $instance['orderby'] ); ?>><?php _e( 'Date', 'genesis' ); ?></option>
+ <option value="modified" <?php selected( 'modified', $instance['orderby'] ); ?>><?php _e( 'Modified Date', 'genesis' ); ?></option>
<option value="title" <?php selected( 'title', $instance['orderby'] ); ?>><?php _e( 'Title', 'genesis' ); ?></option>
<option value="parent" <?php selected( 'parent', $instance['orderby'] ); ?>><?php _e( 'Parent', 'genesis' ); ?></option>
<option value="ID" <?php selected( 'ID', $instanc
@aryanrajseo
aryanrajseo / apache.conf
Created March 2, 2018 04:49 — forked from maliMirkec/apache.conf
Install Varnish on Vesta CP
<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
MaxClients 6
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 1
@aryanrajseo
aryanrajseo / .htaccess
Created January 26, 2018 16:05 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/