Skip to content

Instantly share code, notes, and snippets.

View FutureMedia's full-sized avatar
💭
I may be slow to respond.

Lefteris Theodossiadis FutureMedia

💭
I may be slow to respond.
View GitHub Profile
<?php
/*
I've got a Pod called 'places'. I've geocoded the addresses in 'places', and stored the coordinates in columns 'lat' and 'long'. I'm also doing a GeoIP lookup on my users, and storing their location in $usr_lat and $usr_long. (I promise to share how I'm doing all this when I get the bugs worked out).
Here's my code:
*/
$Record = new Pod('places');
$params = array(
#calendar_div table {
border-collapse:collapse;
}
#cal_table_list td {
vertical-align:top;
padding:4px;
}
#cal_table_list td {
border-bottom:1px dotted #BBB;
}
@FutureMedia
FutureMedia / admin.css
Created October 26, 2012 15:21
A different styling for the wp-post-formats plugin
/*
* Wp-post-formats plugin
* customized admin.css
*
*/
#formatdiv, /* hide default radio button UI */
#titlewrap {
display: none;
}
@FutureMedia
FutureMedia / masonry-responsive.js
Created November 7, 2012 10:54
Masonry responsive layout technique -
// As used by Codroprs
// http://tympanus.net/codrops/collective/collective-36/
jQuery(document).ready(function($) {
var CollManag = (function() {
var $ctCollContainer = $('#ct-coll-container'),
collCnt = 1,
init = function() {
changeColCnt();
initEvents();
@FutureMedia
FutureMedia / no_images.php
Created November 8, 2012 10:37
Wordpress function to remove images from posts
<?php
/**
* Remove images from post content
*
* credits: http://bavotasan.com/2011/a-better-way-to-remove-images-from-a-wordpress-post/
*
* This will remove images on ALL posts! If you don't want this,
* use it in the template code and then add
* remove_filter( 'the_content', 'og2013_no_images' );
* you can also use <?php echo preg_replace("/\]*[.]*\>/i”,”",get_the_content(),1); ?>
@FutureMedia
FutureMedia / gist:4732518
Created February 7, 2013 17:17
Wordpress Contact Form 7 plugin and Paypal payments
on_sent_ok: "location = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=info%40futuremedia.gr&item_name=' + document.getElementsByName('art-title')[0].value + '&amount=' + document.getElementsByName('art-price')[0].value + '&page_style=FutureMedia&no_shipping=1&no_note=1&currency_code=USD&bn=PP-BuyNowBF&charset=UTF-8)';"
@FutureMedia
FutureMedia / wp_nav_search_box.php
Created June 6, 2013 17:24
Add a search box in a WordPress menu that will be rendered through the native wp_nav_menu() function.
// Add a search box in the main navigation menu
function nav_search_box( $items, $args ) {
if( $args->theme_location == 'main-nav' ) {
$items .= '<li class="nav-search">
<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
<input class="nav-search-field" type="search" value="' . get_search_query() . '" name="s" id="s" placeholder="Αναζήτηση" />
</form>
</li>';
return $items;
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
@FutureMedia
FutureMedia / ajax-paging.js
Last active August 29, 2015 13:57
Load custom post type posts in a page via AJAX
jQuery(document).ready(function($){
$('#load-more button').click(function(e){
e.preventDefault(); // revent normal form submission
var postoffset = $('.item').length; // count props on page
$.post( WPaAjax.ajaxurl,
{
action : 'props_more',
/**
* RETORNA URL DO POST_THUMBNAIL PARA BACKGROUND-IMAGE
* @param int: get_the_ID()
* @param string: thumbnail, medium, large, full
**/
function post_thumbnail_url($post_id, $size = 'thumbnail'){
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size );
$url = $thumb[0];
return $url;
}