Skip to content

Instantly share code, notes, and snippets.

View MatRouault's full-sized avatar
🏠
Working from home

Mathieu MatRouault

🏠
Working from home
View GitHub Profile
@joshuadavidnelson
joshuadavidnelson / basic-wp-query.php
Last active August 11, 2019 06:27
Basic WP Query
<?php
$args = array(
'post_type' => array( 'post' ),
'post_status' => array( 'publish' ),
'posts_per_page' => 100, // don't use -1, pick something reasonable
'no_found_rows' => true, // useful when pagination is not needed.
'update_post_meta_cache' => false, // useful when post meta will not be utilized.
'update_post_term_cache' => false, // useful when taxonomy terms will not be utilized.
// 'ignore_sticky_posts' => true, // ignore sticky posts
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
* This will only get the displayed group's menu items
* 1/ if a group is displayed
* 2/ if the theme is containing the template 'buddypress/groups/single/home.php'
* 3/ if the theme's template replaced <ul><?php bp_get_options_nav();?></ul> by <?php bp_nav_menu();?>
*/
@neilgee
neilgee / jetpack-all-modules.php
Last active May 5, 2019 13:08
Remove JetPack CSS
<?php
//Do not copy the above php tag
// Stop JetPacks Minified/Concatention CSS file
add_filter( 'jetpack_implode_frontend_css', '__return_false' );
//Remove JepPack CSS
function themeprefix_remove_jetpack_css() {
wp_deregister_style( 'AtD_style' ); // After the Deadline
wp_deregister_style( 'jetpack_likes' ); // Likes
@woogist
woogist / genesis-functions.php
Last active December 20, 2017 01:51
The code in below will integrate Sensei with the Genesis theme framework from Studio Press. Add the code below into your themes functions.php file.
/*********************
* Sensei Integration
*********************/
/**
* Declare that your theme now supports Sensei
*/
add_action( 'after_setup_theme', 'sensei_support' );
function sensei_support() {
add_theme_support( 'sensei' );
@joshuadavidnelson
joshuadavidnelson / event-admin.js
Created February 19, 2015 21:02
All day toggle for BE Events Calendar with CMB
(function($){
$(document).ready(function(){
$(".cmb_option#event_all_day").bind("change",function(){
if ( $(this).is(':checked') ) {
$("#event_end_time").hide();
$("#event_start_time").hide();
if( $("#event_start_time").val() == '' ) {
$("#event_start_time").val("12:01 AM");
}
@chlab
chlab / Smart_Sitewide_Notices_Widget.class.php
Last active August 29, 2015 14:14
Smarter BuddyPress sitewide notices widget that doesn't display the widget when there are no notices to show
<?php
/**
* Smarter version of the buddypress sitewide notices widget
*
* Fetches the notices in an output buffer and does not display widget when
* there is no content to display.
*
* Sadly this widget is necessary because buddypress only finds out if there
* are notices to be displayed while displaying them.
*
@joshuadavidnelson
joshuadavidnelson / remove-post-type-from-search-results.php
Last active March 8, 2022 13:56
Remove a post type from search results, but keep all others
<?php
/**
* Modify query to remove a post type from search results, but keep all others
*
* @author Joshua David Nelson, josh@joshuadnelson.com
* @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2+
*/
add_action( 'pre_get_posts', 'jdn_modify_query' );
function jdn_modify_query( $query ) {
@lmartins
lmartins / genesis_attr_add_class.php
Last active September 20, 2022 13:33 — forked from JiveDig/genesis_attr_add_class.php
Add classes and attributes to any element in Genesis
<?php
//* Add class to .site-container
add_filter('genesis_attr_site-container', 'jive_attributes_st_container');
function jive_attributes_st_container($attributes) {
$attributes['class'] .= ' st-container';
return $attributes;
}
//* Add class to .site-inner
@slaFFik
slaFFik / bp-xprofile-countries-list.php
Last active April 1, 2021 14:57 — forked from shanebp/BuddyPress xprofile add countries
BuddyPress xProfile - Add Countries
<?php
/**
* If you are using BP 2.1+, this will insert a Country selectbox.
* Add the function to bp-custom.php and then visit .../wp-admin/users.php?page=bp-profile-setup
*/
function bp_add_custom_country_list() {
if ( !xprofile_get_field_id_from_name('Country') && 'bp-profile-setup' == $_GET['page'] ) {
@imath
imath / bp-custom.php
Created August 14, 2014 13:18
This a snippet to auto join "just activated" members in one or more BuddyPress groups.
<?php
if ( ! class_exists( 'Imath_Auto_Join_Groups' ) ) :
/**
* AutoJoin new members to chosen groups
*
* This is a little snippet, feel free to :
* - use it
* - extend it..