Skip to content

Instantly share code, notes, and snippets.

View thierrypigot's full-sized avatar

Thierry Pigot thierrypigot

View GitHub Profile
@thierrypigot
thierrypigot / acf-options-subpage.php
Created July 22, 2015 11:27
Ajoute des sous pages à la page d'options ACF
<?php
if( function_exists( 'acf_add_options_page' ) )
{
acf_add_options_page();
acf_add_options_sub_page( 'Subpage 1 name' );
acf_add_options_sub_page( 'Subpage 2 name' );
}
@thierrypigot
thierrypigot / functions.php
Last active April 20, 2021 04:50
Infinite Scroll Genesis inside div with overflow:scroll
<?php
# infinite scroll Genesis
remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
function is_blog ()
{
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
@thierrypigot
thierrypigot / settings.php
Last active August 29, 2015 14:25
Allows admin pages containing settings forms to be managed semi-automatically. It lets you define settings pages, sections within those pages and fields within the sections.
<?php
// ------------------------------------------------------------------
// Add all your sections, fields and settings during admin_init
// ------------------------------------------------------------------
//
function tp_settings_api_init()
{
// Add the section to reading settings so we can add our
// fields to it
add_settings_section(
@thierrypigot
thierrypigot / .htaccess
Created August 19, 2015 15:38
Forcer un site à être en https
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [QSA,R=301,L]
@thierrypigot
thierrypigot / functions.php
Last active August 29, 2015 14:27
Add excerpts to pages
<?php
/**
* Add excerpts to pages
*/
add_action( 'init', 'eemi_add_excerpts_to_pages' );
function eemi_add_excerpts_to_pages()
{
add_post_type_support( 'page', 'excerpt' );
}
@thierrypigot
thierrypigot / backToTop.css
Created August 21, 2015 10:01
Add back to top in Genesis
/* ## Back to top
--------------------------------------------- */
.eemi-top:hover {
color: #fff !important;
background-color: rgba(0,0,0,0.8);
text-decoration: none;
}
.eemi-top {
display: none;
@thierrypigot
thierrypigot / .htaccess
Created September 3, 2015 10:04
Rewrite url
RewriteEngine On
RewriteRule ^produit/(.*)$ produit?prod=$1 [L]
@thierrypigot
thierrypigot / corner.html
Last active October 1, 2015 20:44
Corner
<style>
body{background:red}
.wrapper{
position: relative;
width: 600px;
background: #A8C0CF;
margin-top: 20px;
padding: 24px;
display: block;
margin-left: auto;
@thierrypigot
thierrypigot / page.html
Created November 18, 2015 17:23
Sidebar follow screen on scroll
<div id="wrap">
<div id="header"></div>
<div id="inner">
<div class="wrap">
<div id="content-sidebar-wrap">
<div id="content" class="hfeed"></div>
<div id="sidebar" class="sidebar widget-area"></div>
</div>
</div>
</div>
@thierrypigot
thierrypigot / .htaccess
Created December 16, 2015 10:04
Limiter l'accès à wp-admin ou wp-login.php à certaines IP
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^255\.255\.255\.255$
RewriteRule ^(.*)$ - [R=403,L]
</IfModule>