Skip to content

Instantly share code, notes, and snippets.

View celticwebdesign's full-sized avatar

Darren Stevens celticwebdesign

View GitHub Profile
query_posts( $query_string . '&posts_per_page=-1' );
if (have_posts()): while (have_posts()) : the_post(); ?>
# initializr
# ######################################################################
# # WEB PERFORMANCE #
# ######################################################################
# ----------------------------------------------------------------------
# | Compression |
# ----------------------------------------------------------------------
// http://www.wpbeginner.com/wp-tutorials/how-to-create-a-custom-wordpress-widget/
//
// Select a Restaurant
class eoc_widget_select_restaurant extends WP_Widget {
function __construct() {
parent::__construct(
// Base ID of your widget
'eoc_widget_select_restaurant',
category.php
<?php
$homepg=get_bloginfo('url')."/news-notices/news/";
header("Location: $homepg",TRUE,301);
// http://websistent.com/redirect-wordpress-archives/
// Redirect unused category page to news page.
?>
<body
<?php
if( is_singular('things_to_do') ) {
// allows us to add taxonomy term to body class
$things_to_do_queried_object = get_queried_object();
$terms = get_the_terms( $things_to_do_queried_object->ID, 'things_to_do_type' );
if ( $terms && ! is_wp_error( $terms ) ) :
$draught_links = array();
@celticwebdesign
celticwebdesign / WordPress - get attachment by name and display in page
Created August 12, 2016 10:37
WordPress - get attachment by url parameter and display in page
http://xxx.com/race-results/?series=Attachment_Name_Here.html
if( isset( $_GET['series'] ) ) {
function get_attachment_url_by_slug( $slug ) {
$args = array(
@celticwebdesign
celticwebdesign / Dev Template Name 2
Last active February 8, 2017 09:49
Now uses wp_footer hook.
HTML ------
NONE
HTML ------
PHP functions.php ------
@celticwebdesign
celticwebdesign / WordPress Single Post - Previous Next Articles
Created August 7, 2016 20:51
WordPress Single Post - Previous Next Articles
<!-- prev post next -->
<div class="prev_next clear">
<div class="left prev">
<?php
previous_post_link('&laquo; %link','Previous post');
?>
</div>
<div class="right next">
<?php
next_post_link('%link &raquo;','Next post');
@celticwebdesign
celticwebdesign / WordPress loop objects into array
Created July 26, 2016 07:34
WordPress loop objects into array
$args = array(
'post_type' => 'products',
'post_status' => 'publish',
'posts_per_page' => -1
);
$child_query = new WP_Query($args);
$brands_array = [];
<section class="wrapper full taxonomy-kitchens">
<div class="wrapper narrow collapse">
<?php
$args = array(
'post_type' => 'photo',
'posts_per_page' => '15',
'orderby' => 'rand',