Skip to content

Instantly share code, notes, and snippets.

View ms-studio's full-sized avatar

Manuel Schmalstieg ms-studio

View GitHub Profile
@ms-studio
ms-studio / WP-meta-description-tag.php
Last active April 7, 2022 19:27
WordPress meta description tag
<?php // ** DESCRIPTION v.0.2 **
if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post();
?><meta name="description" content="<?php
$descr = get_the_excerpt();
$text = str_replace( "\r\n", ', ', trim($descr) );
echo esc_attr($text);
?>" />
<?php endwhile; endif; elseif(is_home()) :
?><meta name="description" content="<?php bloginfo('description'); ?>" />
<?php endif; ?>
@ms-studio
ms-studio / WP-event-manager-notes.php
Created July 13, 2012 14:07
Notes regarding the WP event manager
<?php
/*
Target:
*******
Perfect solution for a simple WP event manager
Needs:
******
@ms-studio
ms-studio / scribus-colophon.py
Created July 16, 2012 13:06
A Scribus script for generating an automatic colophon
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
un petit script destiné à générer un colophon technique
License GPL 2.0
Auteur: manuel schmalstieg
"""
@ms-studio
ms-studio / outgoing-links.js
Created July 26, 2012 12:35
jQuery outgoing-links-in-new-window function
@ms-studio
ms-studio / gist:3313103
Created August 10, 2012 09:54
Output WP custom field as list
<?php
$weblinks = get_post_meta($post->ID, 'Web-Link', false);
// false = will return an array of results
if ($weblinks) {
?>
<div class="hyperlinks">
<?php
foreach($weblinks as $weblink) {
@ms-studio
ms-studio / 010-functions.php
Created August 23, 2012 09:54
Using vimeo API in Wordpress
// vimeo helper function
// Curl helper function
// based on this example
// https://github.com/vimeo/vimeo-api-examples/blob/master/simple-api/simple/simple.php
// detailed explanations are in this post:
// http://ms-studio.net/2012/notes/using-the-vimeo-api-in-wordpress/
function curl_get($url) {
$curl = curl_init($url);
@ms-studio
ms-studio / function-image-toolbox.php
Created August 25, 2012 12:29
WordPress image toolbox
// Image Toolbox
// ******************************
// based on http://digwp.com/2009/08/awesome-image-attachment-recipes-for-wordpress/
function image_toolbox($size = 'thumbnail', $howmany = -1, $link = 'no', $list = 'no') {
if ( $images = get_children ( array (
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => $howmany , // -1 = show all
'post_status' => null,
@ms-studio
ms-studio / gist:3608471
Created September 3, 2012 10:42
Provide link only if post has some content
if($post->post_content != "") {
// the post HAS some content ...
?>
<a href="<?php the_permalink();?>"><?php the_title();?></a>
<?php
} else {
// the post is EMPTY ...
the_title();
}
@ms-studio
ms-studio / WP-attachment-toolbox.php
Created September 6, 2012 07:50
WordPress attachment toolbox function
function attachment_toolbox() {
global $post;
if($attachments = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1, // -1 = show all
'post_status' => null,
'post_mime_type' => 'application',
// 'post_mime_type' => 'application/msword,application/pdf',
'orderby' => 'menu_order',
@ms-studio
ms-studio / WP-img-toolbox-array.php
Created October 21, 2012 22:30
WP image toolbox array
// paste this function into your functions.php file
function image_toolbox_array($size = 'thumbnail', $howmany = -1) {
if ( $images = get_children ( array (
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => $howmany , // -1 = show all
'post_status' => null,
'post_mime_type' => 'image',
'orderby' => 'menu_order',