Skip to content

Instantly share code, notes, and snippets.

View jwdsign's full-sized avatar
🎧
Plugged-In and churning out updates

Jan Wambach jwdsign

🎧
Plugged-In and churning out updates
View GitHub Profile
@jwdsign
jwdsign / _module-article.php
Created September 10, 2014 10:22
Wordpress Single Article Module with Schema.org Microdata
<article class="_module-article article--full" itemscope itemtype='http://schema.org/Article'>
<?php setPostViews(get_the_ID()); //track post views ?>
<header class="article-header">
<meta itemprop='keywords' content='<?php tag_list(); ?>'/>
<meta itemprop='inLanguage' content='<?php language_attributes(); ?>'/>
<meta itemprop='interactionCount' content='UserPageVisits:<?php echo getPostViews(get_the_ID()); //log post-views as user-interactions ?>'/>
<meta itemprop='description' content='<?php the_excerpt(); ?>'/>
@jwdsign
jwdsign / _function-taglist-plaintext.php
Created September 10, 2014 10:16
Helper Function: Plain-text list of tags
<?php
function tag_list() {
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ' ';
}
}
}
@jwdsign
jwdsign / _function-get-post-views.php
Created September 10, 2014 10:09
Helper Function: Track Single Post Views
<?php
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 View";
}
return $count.' Views';
@jwdsign
jwdsign / _function-first-cat-name.php
Created September 10, 2014 10:04
Helper Function: Get first category name
<?php
function category_name() {
$category = get_the_category();
echo $category[0]->cat_name;
}
?>
@jwdsign
jwdsign / _function_author_helpers.php
Created September 10, 2014 09:34
Article Author Helper Functions
<?php
function the_author_link() {
$authorURL = get_the_author_link();
echo $authorURL;
}
function the_author_name() {
$authorName = get_the_author();
echo $authorName;
@jwdsign
jwdsign / _function-post-thumbnail-url.php
Last active August 29, 2015 14:06
Post Thumbnail URL Helper Function
<?php
function the_post_thumbnail_url() {
$thumbnailURL = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo $thumbnailURL
}
?>
@jwdsign
jwdsign / _function-post-thumbnail-caption.php
Created September 10, 2014 09:23
Post Thumbnail Descriptions
<?php
function the_post_thumbnail_caption() {
global $post;
$thumb_id = get_post_thumbnail_id($post->id);
$args = array(
'post_type' => 'attachment',
'post_status' => null,
'post_parent' => $post->ID,
@jwdsign
jwdsign / _module-businessinfo
Created September 10, 2014 07:17
_module-businessinfo
<div class="_module-businessinfo businessinfo--full" itemscope itemtype="http://schema.org/LocalBusiness">
<div class="businessinfo-name" itemprop="name"><?php the_field('firmenbezeichnung', 'option'); ?></div>
<div class="businessinfo-address" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span class="businessinfo-streetAddress" itemprop="streetAddress"><?php the_field('strasse_hausnummer', 'option'); ?></span>
<span class="businessinfo-postalCode" itemprop="postalCode"><?php the_field('postleitzahl', 'option'); ?></span>
<span class="businessinfo-addressLocality" itemprop="addressLocality"><?php the_field('ort', 'option'); ?></span>
<span class="businessinfo-addressRegion" itemprop="addressRegion"><?php the_field('bundesland', 'option'); ?></span>
</div>
@jwdsign
jwdsign / _module-person.php
Last active August 29, 2015 14:06
_module-person
<article class="_module-person person--full" itemscope itemtype="http://schema.org/Person">
<div class="person-image">
<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>
<img src="<?php echo $url; ?>" itemprop="image" alt="Bild von <?php the_title(); ?>" title="<?php the_title(); ?>" />
</div>
<h3 class="person-name" itemprop="name"><?php the_title(); ?></h3>
<span class="person-jobTitle" itemprop="jobTitle"><?php the_field('person-jobTitle'); ?></span>
@jwdsign
jwdsign / _module-job-offer.php
Created September 10, 2014 07:14
_module-job-offer
<article class="_module-job-offer job-offer--full" itemscope itemtype="http://schema.org/JobPosting">
<header class="_module-job-offer-header">
<h1 class="job-title" itemprop="title"><?php the_title(); ?></h1>
<div class="job-hours">
<h3 class="job-subhead"><?php _e('Arbeitszeiten:', 'euw'); ?></h3>
<span class="job-hours-type" itemprop="employmentType"><?php the_field('_module-job-offer-overview-type'); ?></span>
<span class="job-hours-amount" itemprop="workHours"><?php the_field('_module-job-offer-overview-hours'); ?></span>