Skip to content

Instantly share code, notes, and snippets.

View codee47's full-sized avatar

Gergő Szalai codee47

View GitHub Profile
<?php
/* Woocommerce - Árukereső Trusted Shop integrálása
** az alábbi kódrészletbe csak be kell illeszteni az
** árukeresőtől kapott webapi kódot majd az egészet át
** kell másolni a sablon functions.php fájljába. */
add_action( 'woocommerce_thankyou', 'arukereso_trusted_shop' );
function arukereso_trusted_shop( $order_id ) {
function check_for_shortcode($posts) {
if ( empty($posts) )
return $posts;
 
// false because we have to search through the posts first
$found = false;
 
// search through each post
foreach ($posts as $post) {
// check the post content for the short code
// if no title then add widget content wrapper to before widget
add_filter( 'dynamic_sidebar_params', 'check_sidebar_params' );
function check_sidebar_params( $params ) {
global $wp_registered_widgets;
$settings_getter = $wp_registered_widgets[ $params[0]['widget_id'] ]['callback'][0];
$settings = $settings_getter->get_settings();
$settings = $settings[ $params[1]['number'] ];
if ( $params[0][ 'after_widget' ] == '</div></div>' && isset( $settings[ 'title' ] ) && empty( $settings[ 'title' ] ) )
@codee47
codee47 / google_clicktag.as
Last active December 24, 2015 13:39
Google ClickTag
on (release){
getURL(_level0.clickTAG, "_blank");
}
@codee47
codee47 / adverticum_clicktag.as
Last active December 24, 2015 13:39
Adverticum ClickTag
on(release){
getURL(_root.clickTAG, "_blank");
}
@codee47
codee47 / woocommerce_add_script_to_thankyou.php
Last active December 24, 2015 11:29 — forked from mikejolley/functions.php
Add script to thank you page in woocommerce.
<?php
add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
function my_custom_tracking( $order_id ) {
// Lets grab the order
$order = new WC_Order( $order_id );
/**
@codee47
codee47 / display_first_thumbnail.php
Last active December 18, 2015 12:18
Display just the first thumbnail in wordpress.
<?php $first = true; ?>
<?php /*Post query*/ ?>
<?php if ( $first ) : ?>
<?php if ( has_post_thumbnail() ) { ?>
<figure class="post-thumb aligncenter">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Link ehhez %s', 'akg' ), the_title_attribute( 'echo=0' ) ); ?>"><?php the_post_thumbnail( 'topstories-thumb' ) ?></a>
</figure>
<?php } ?>
<?php $first = false; ?>
<?php endif; ?>
@codee47
codee47 / woo-loop-image-wrap.php
Created June 10, 2013 05:49 — forked from krogsgard/woo-loop-image-wrap.php
This snippet removes the action that inserts thumbnails to products in the loop and re-adds the function customized with our wrapper in it. It applies to all archives with products.
<?php
/* This snippet removes the action that inserts thumbnails to products in teh loop
* and re-adds the function customized with our wrapper in it.
* It applies to all archives with products.
*
* @original plugin: WooCommerce
* @author of snippet: Brian Krogsard
*/
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
@codee47
codee47 / Rename the Uploaded Media File to Post Title
Last active December 16, 2015 09:48
Rename the uploaded media file to post title.
/*-----------------------------------------------------------------------------------*/
/* Rename the Uploaded Media File to Post Title
/*-----------------------------------------------------------------------------------*/
add_filter( 'sanitize_file_name', 'cb_sanitize_file_name' );
/**
* @internal Missing short description
*
* @link wp-includes|formatting.php
* @todo causing errors at media-new.php