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 / functions.php
Created July 31, 2011 00:24 — forked from anonymous/functions.php
WPAlchemy - Issue getting value pulled into page template
<?php
// add Gallery Images custom meta box
$mgallery = new WPAlchemy_MetaBox(array
(
'id' => '_gallery_main',
'title' => 'Gallery Images',
'types' => array('gallery_main'), // added only for pages
'context' => 'normal', // same as above, defaults to "normal"
'priority' => 'high', // same as above, defaults to "high"
@farinspace
farinspace / combos.php
Last active February 4, 2021 11:56
Recursive functions, I can never find exactly what I need in a pinch
<?php
function combos($data, &$all = array(), $group = array(), $val = null, $i = 0) {
if (isset($val)) {
array_push($group, $val);
}
if ($i >= count($data)) {
array_push($all, $group);
} else {
foreach ($data[$i] as $v) {
@farinspace
farinspace / testimonial-meta.php
Created September 1, 2011 15:06 — forked from armandmorin/testimonial-meta.php
Metabox Outside of Group
<?php
/**
* NOTE: The radio buttons which determine a css style in my program are CURRENTLY inside the group.
* I am trying to do this OUTSIDE of the group. If I leave it inside the group, I have to define the settings for each testimonial I have. I want to set it once and
* have it define each instance.
*
*/
?>
<div class="mcms_optinpage">
<?php
global $testimonial_metabox;
$testimonial_bg = $testimonial_metabox->get_the_value( 'background' );
$testimonials = $testimonial_metabox->get_the_value( 'testimonials' );
?>
@farinspace
farinspace / gif.php
Created October 9, 2011 03:55
PHP function to write a blank 1px gif
function writeGif()
{
header( 'Content-type: image/gif' );
header( 'Expires: Wed, 11 Nov 1998 11:11:11 GMT' );
header( 'Cache-Control: no-cache' );
header( 'Cache-Control: must-revalidate' );
@farinspace
farinspace / functions.php
Created October 11, 2011 19:45
Includes that might be needed when the wordpress editor is not enabled
wp_enqueue_script('post');
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');
wp_enqueue_script('schedule');
wp_enqueue_script('editor');
@farinspace
farinspace / simple-meta.php
Created October 13, 2011 03:04
Quick code fix for Locke
<div class="my_meta_control">
<a style="float:right; margin:0 10px;" href="#" class="dodelete-docs button">Remove All</a>
<p>Add Product Guide</p>
<?php while($mb->have_fields_and_multi('_nb_docs')): ?>
<?php $mb->the_group_open(); ?>
<?php $mb->the_field('_nb_title'); ?>
@farinspace
farinspace / dates-meta.php
Created October 25, 2011 16:20 — forked from emzo/dates-meta.php
WPAlchemy: Modify cloned item of repeating field group
<a style="float:right; margin:0 10px;" href="#" class="dodelete-dates button">Remove All Dates</a>
<p>Add dates on which this course will run.</p>
<?php while($mb->have_fields_and_multi('dates')): ?>
<?php $mb->the_group_open(); ?>
<?php $mb->the_field('date'); ?>
<p><input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>" class="datepicker" />
<a href="#" class="dodelete button">Remove Date</a></p>
@farinspace
farinspace / people-links-meta.php
Created November 10, 2011 17:06 — forked from kirstenkeister/people-links-meta.php
WPAlchemy meta definitions for people-links
@farinspace
farinspace / bbpress-hooks.php
Created November 17, 2011 07:53
Generate a list of hooks and filters for bbpress 2.0.1
<?php
// place and run in ./plugins/bbpress/bbp-themes
$dirs = array( './bbp-twentyten', './bbp-twentyten/bbpress' );
$actions = array();
$filters = array();