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
@MatRouault
MatRouault / frontpage-slideshow.php
Last active May 12, 2016 21:21
Frontpage with a post slideshow in Beans Framework
/* REF : Mike Hopkins / See : https://community.getbeans.io/discussion/frontpage-with-a-post-slideshow */
add_action( 'beans_main_prepend_markup', 'post_slider' );
function post_slider() {
$query = new WP_Query( array(
'category_name' => 'featured',
'paged' => get_query_var( 'paged' ),
'nopaging' => false
@MatRouault
MatRouault / related-posts.php
Last active May 20, 2018 18:12
Related Posts for Beans Framework
@MatRouault
MatRouault / beans-ninja-forms.php
Last active April 24, 2016 10:23
Beans - Adapt Ninja Forms for UiKit
<?php
// Do not include the opening php tag if it is already included in your file.
//* Note : A good practice is to load this snippet only if the plugin is activated.
//* Add this in your functions.php and the snippet in itself in a separate file.
// include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
// if( is_plugin_active( 'ninja-forms/ninja-forms.php' ) ) {
// include_once( get_stylesheet_directory() . '/lib/beans-ninja-forms.php' );
// }
@MatRouault
MatRouault / add_subheader.php
Last active April 23, 2016 19:01
Beans - Add a sub-header on category archive page
<?php
// Do not include the opening php tag if it is already included in your file.
//* Add a sub-header on category archive page
add_action( 'beans_header_after_markup', 'sps_add_archive_under_header' );
function sps_add_archive_under_header () {
if ( !is_archive() )
return;
@MatRouault
MatRouault / showexcerpt.php
Last active April 23, 2016 15:09
Beans - Show Excerpt or Troncate Content if we're NOT on a singular post/page
<?php
// Do not include the opening php tag if it is already included in your file.
//* Show Excerpt or Troncate Posts Content
add_filter( 'the_content', 'sps_troncate_post_content' );
function sps_troncate_post_content( $content ){
if ( !is_singular() )
<?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.
// 'fields' => 'ids' // only good if all you need is ids
@MatRouault
MatRouault / jobs-cpt.php
Last active April 15, 2016 10:13
Add Jobs Custom Post Type with taxonomy. Custom Fields built with Beans Framework APi.
<?php
/*
Plugin Name: Jobs CPT
Plugin URI: http://yourwebsite.com/
Description: Add Jobs CPT with taxonomy. Custom fields built with Beans Framework.
Version: 1.0
Author: You.
Author URI: http://yoururl.com/
License: GPLv2
*/
@MatRouault
MatRouault / beans-secondary-menu.php
Last active April 14, 2016 19:47
Create a secondary sticky menu in Beans Framework and add this below header
<?php
// Do not include the opening php tag if it is already included in your file.
/* This code snippet adds a secondary sticky navigation in a subheader in #BeansTheme Framework.
* You can paste this in your functions.php file or add it in a a child-theme customization plugin.
* Some refs :
* http://www.getbeans.io/
* http://getuikit.com/docs/subnav.html
* http://getuikit.com/docs/sticky.html
* http://www.getbeans.io/code-reference/functions/beans_primary_menu/
@MatRouault
MatRouault / addlinktobpmenu.php
Last active February 3, 2020 20:18
Add Link to BP Menu (User or Group)
<?php
// Do not include the opening php tag if it is already included in your file.
//* http://buddydev.com/buddypress/add-extra-links-to-buddypress-user-profile-menu-buddypress-group-menu/
add_action( 'after_setup_theme', 'buddydev_register_menus' );
function buddydev_register_menus() {
register_nav_menu( 'bp-profile-extra-links', __( 'Extra profile links' ) );
register_nav_menu( 'bp-group-extra-links', __( 'Extra Group links' ) );
@MatRouault
MatRouault / Buddydrive in a Page
Last active August 29, 2015 14:24
Buddydrive in a Page Template
<?php
/*
Template Name: Documents
*/
//* Remove Genesis Loop and Add Custom Loop Instead
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'fcu_do_custom_loop' );
/**