Skip to content

Instantly share code, notes, and snippets.

View farinspace's full-sized avatar
🙃
working ...

Dimas Begunoff farinspace

🙃
working ...
View GitHub Profile
@farinspace
farinspace / videos_projects
Created December 17, 2011 18:53 — forked from fchouquet/videos_projects
Can't get videos working
<?php global $video_metabox; $video_metabox->the_meta(); ?>
<?php if ( $video_metabox->have_value( 'vids' ) ) { ?>
<ul class="project_videos">
<?php while( $video_metabox->have_fields('vids') ) { ?>
<?php echo wp_oembed_get( $video_metabox->the_value( 'videourl' ) ); ?>
<?php } ?>
</ul>
@farinspace
farinspace / project-meta.php
Created January 19, 2012 17:17 — forked from kirstenkeister/project-meta.php
WPAlchemy meta definitions for project-meta
<div class="my_meta_control">
<a style="float:right; margin:0 10px;" href="#" class="dodelete-links button remove-all">Remove All</a>
<label>Project Staff<span>(current Staff associated with the project)</span></label>
<p>Add staff to project by selecting them from the dropdown. Add addtional staff by clicking the "Add Staff" button.</p>
<?php
@farinspace
farinspace / custom-spec.php
Created February 1, 2012 21:34
Using WP Alchemy output_filter
$custom_metabox = new WPAlchemy_MetaBox(array
(
'id' => '_custom_meta',
'title' => 'My Custom Meta',
'template' => get_stylesheet_directory() . '/custom/meta.php',
'output_filter' => 'my_output_filter',
));
function my_output_filter ( $post_id )
{
<div class="carousel">
<a href="#" class="prev">&nbsp</a>
<ul id="mycarousel" class="jcarousel-skin-carousel">
<?php global $ad_metabox; ?>
<?php query_posts('post_type=ad&showposts=-1') ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<li>
<?php global $custom_checkbox_mb;
$custom_checkbox_mb->the_meta();
if ($custom_checkbox_mb->have_value('cb_ex2')) { ?>
<ul>
<?php while($custom_checkbox_mb->have_fields('cb_ex2')) { ?>
<li><?php $custom_checkbox_mb->the_value(); ?></li>
<div class="my_meta_control">
<h4>Links</h4>
<a href="#" class="dodelete-links button">Remove All Links</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras orci lorem, bibendum in pharetra ac, luctus ut mauris.</p>
<?php while($mb->have_fields_and_multi('links')): ?>
<?php $mb->the_group_open(); ?>
@farinspace
farinspace / comma.php
Created April 13, 2012 17:00
put values into an array and then output as string
global $my_metabox;
$output = array();
while( $my_metabox->have_fields( 'my_fields' ) )
{
array_push( $output, sprintf( $my_metabox->get_the_value( 'my_value' ) ) );
}
echo join(', ', $output);
@farinspace
farinspace / help.php
Created July 17, 2012 20:48
quick code
global $basic_info;
// $posts is a list of posts for which you have meta data for
foreach ( $posts as $post )
{
$meta = $basic_info->the_meta( $post->ID );
if ( isset( $meta['basic_info'] ) )
{
class cfd_user {
protected $profile_fields = array(
'user_login' => null,
'user_nicename' => null,
'user_url' => null,
'user_email' => null,
'display_name' => null,
'nickname' => null,
'first_name' => null,
'last_name' => null,
@farinspace
farinspace / functions.php
Last active February 27, 2016 03:32
Noon Plugin "nooz_shortcode" filter usage example.
<?php
function my_custom_template( $output, $data ) {
// loop $data['items'], use post ID, to get additional meta data if needed
// ...
// filter by type to output different templates
if ( 'coverage' == $data['type'] ) {
ob_start();
// $data variable is available inside PHP file