Skip to content

Instantly share code, notes, and snippets.

@zulfnore
zulfnore / formats.php
Last active August 29, 2015 14:14
Video extration from content to be displayed in place of post thumbnail.
<?php
function wpdevhq_get_video(){
global $wpdevhq_videos;
$post_id = get_the_ID();
if( empty( $wpdevhq_videos ) ) $wpdevhq_videos = array();
if( isset($wpdevhq_videos[$post_id]) ) return $wpdevhq_videos[$post_id];
$content = get_the_content();
$content = apply_filters( 'the_content', $content );
@zulfnore
zulfnore / header.php
Last active August 29, 2015 14:14
Unconditional Metaslider integration
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
@zulfnore
zulfnore / single.php
Last active August 29, 2015 14:13
Amended single.php for Ridizain
<?php
/**
* The Template for displaying all single posts
* This amendment is in reference to: https://wordpress.org/support/topic/query-about-ad-placement?replies=7
*
* @package Ridizain
* @since Ridizain 1.0
*/
get_header(); ?>
@zulfnore
zulfnore / full-width.php
Created December 28, 2014 00:46
Full widht tempalte for WP HeadR child theme.
<?php
/**
* Template Name: Full Width Page
*
* @package wpheadr
* @since wpheadr 1.0.6
*/
get_header(); ?>
@zulfnore
zulfnore / gist:9036874
Last active August 29, 2015 13:56
Anew content.php with featured image in blog feed
<?php $format = get_post_format(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('group'); ?>>
<h2 class="post-title pad">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h2><!--/.post-title-->
<ul class="post-meta pad group">
<li><?php the_category(' / '); ?></li>
@zulfnore
zulfnore / gist:6558084
Created September 14, 2013 01:40
WP_Query and pagination
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$strapvert_blog_query = new WP_Query(
array(
'paged' => $paged,
'post__not_in' => get_option( 'sticky_posts' ),
)
);
?>
<?php if ( $strapvert_blog_query->have_posts() ) : ?>
@zulfnore
zulfnore / gist:5698446
Last active December 18, 2015 00:39
Support for site title in absence of a logo
<div id="header">
<div class="container">
<?php if (themeslug_get_option('logo')) : ?>
<div id="logo">
<a href="<?php echo esc_url( home_url() ); ?>">
<img src="<?php echo esc_url( themeslug_get_option('logo') ); ?>" alt="<?php bloginfo('name') ?>">
</a>
</div>
<?php else : ?>
<div id="logo">
@zulfnore
zulfnore / custom.php
Last active December 15, 2015 23:29
Adding support for post thumbnails to Shoestrap - copy the code below in to your custom.php located in shoestrap/lib
<?php
// Custom functions
set_post_thumbnail_size(250, 150, true); // Adjust these to suit your needs
add_image_size('single-thumb', 1200, 300, true); // For optimum results use a wider width than the container - You can adjust the heigh to suit your needs
function shoestrap_display_images_on_posts() {
echo '<div class="entry-thumbnail img-polaroid img-rounded" style="float: left; margin: 0 10px 5px 0;">' ;
the_post_thumbnail();
echo '</div>' ;
@zulfnore
zulfnore / hero-functions.txt
Created April 7, 2013 00:57
FitText and WordPress issues for Shoestrap
// In shoestrap/lib/customizer/hero/functions.php locate the line @ 172 which reads
echo '<script>$(".hero-title").fitText();</script>';
// and change it to read
echo '<script>jQuery(".hero-title").fitText(1.1, { minFontSize: 48, maxFontSize: 100 });</script>';
// This should resize the title from its original size of 100px to a minimum of 48px at the lowest viewpoint - the 48px is to prevent the title from becoming smaller than the content text.
<?php
/*
Template Name: Full-Width
*/
?>
<?php get_template_part('templates/page', 'header'); ?> <!-- This is the code being refered to OP -->
<?php get_template_part('templates/content', 'page'); ?>