This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (class_exists('IMGCustomPostTypes') === true ) { // chekc for plugin activation | |
// 1 Initialise a new custom post type | |
$cpt_example = new IMGCustomPostTypes(); | |
// 2 Add your custom fields | |
$cpt_example->customFields = array('example_foo', 'example_bar'); | |
// 3 Set your naming conventions | |
$cpt_example->namingConventions = array( | |
'name' => 'example', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (class_exists('IMGCustomPostTypes') === true ) { // check for plugin activation | |
// 1 Initialise a new custom post type | |
$cpt_example = new IMGCustomPostTypes(); | |
// 2 Set your naming conventions | |
$cpt_example->namingConventions = array( | |
'name' => 'example', | |
'singular' => 'Example', | |
'plural' => 'Examples', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (class_exists('IMGCustomPostTypes') === true ) { // check for plugin activation | |
// 1 Initialise a new custom post type | |
$cpt_example = new IMGCustomPostTypes(); | |
// 2 Add your custom fields | |
$cpt_example->customFields = array('example_foo', 'example_bar'); | |
// 3 Set your naming conventions | |
$cpt_example->namingConventions = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (class_exists('IMGCustomPostTypes') === true ) { // check for plugin activation | |
// 1 Initialise a new custom post type | |
$cpt_example = new IMGCustomPostTypes(); | |
// 2 Add your custom fields - appending _textarea or _boolean changes the custom meta field edit box | |
$cpt_example->customFields = array('example_foo_textarea', 'example_bar_boolean', 'example_bar_date'); | |
// 3 Set your naming conventions | |
$cpt_example->namingConventions = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: IMG Custom Post Types | |
Plugin URI: http://imgiseverything.co.uk/wordpress-plugins/img-custom-post-types/ | |
Description: Functionality to allow easy adding of custom post types via the functions.php file | |
Author: Phil Thompson | |
Version: 0.92 | |
Author URI: http://imgiseverything.co.uk/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will get all posts whose 'event_date' is today or later ordered by closest date | |
$custom_posts = get_posts(array( | |
'meta_compare' => '>', | |
'meta_key' => 'event_date_strtotime', // <- this is your custom field (see notes below) | |
'meta_value' => strtotime('-1 day'), | |
'numberposts' => 4, | |
'order' => 'ASC', | |
'orderby' => 'meta_value', | |
'post_type' => 'event' // <- this is the name of your custom post type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the HTML | |
<head> | |
<script type="text/javascript"> | |
var MTUserId='xyz'; // made xyz instead of actual string | |
var MTFontIds = new Array(); | |
MTFontIds.push("abc"); // made abc instead of id of the fonts | |
MTFontIds.push("def"); // made def instead of id of the fonts | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<picture> | |
<!--[if IE 9]><video style="display: none;"><![endif]--> | |
<source media="(min-width: 633px)" srcset="/assets/images/content/drone-rangers/cover-961x600.jpg" type="image/jpeg"> | |
<source media="(min-width: 472px)" srcset="/assets/images/content/drone-rangers/cover-632x600.jpg" type="image/jpeg"> | |
<source media="(min-width: 321px)" srcset="/assets/images/content/drone-rangers/cover-471x600.jpg" type="image/jpeg"> | |
<source srcset="/assets/images/content/drone-rangers/cover-312x600.jpg" type="image/jpeg"> | |
<!--[if IE 9]></video><![endif]--> | |
<img srcset="/assets/images/content/drone-rangers/cover-312x600.jpg" alt="" width="961" height="600" class="ef-video__media ef-video__media--hero"> | |
</picture> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Place the SVG sprite inside a div with its display set to none. | |
SVG sprites must appear before they are used in HTML source order and they must be hidden from view. | |
Inlining the CSS means if there's any delay loading your stylesheet then the sprite will still be hidden | |
--> | |
<div style="display:none;"> | |
<svg xmlns="http://www.w3.org/2000/svg"> | |
<symbol viewBox="0 0 8.3 8.3" id="icon-close" aria-label="Close"><title>Close</title><path d="M8.3,0.3L8,0L4.2,3.8L0.3,0L0,0.3l3.8,3.8L0,8l0.3,0.3l3.8-3.8L8,8.3L8.3,8L4.5,4.2"/> | |
</symbol> | |
</svg> |
OlderNewer