I've created a child theme, and moved all the modifications I had in the parent theme functions.php into the child theme's functions.php. Now if I preview the theme, it is blank.
I've got three things - changing the number of tags displayed in the cloud, hiding a product category and displaying a Google books preview.
I can't see any errors in this code, and it works when it's in the parent.
I would appreciate any help, I'm totally stuck!
<?php
function change_tag_cloud_widget() {
$args['number'] = 15;
return $args;
}
add_filter( 'widget_tag_cloud_args', 'change_tag_cloud_widget' );
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() ) {
$q->set( 'tax_query', array(array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'hands-on' ), // Don't display products in the hands-on category on the shop page
'operator' => 'NOT IN'
)));
}
remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
}
add_shortcode('gbooks', 'sc_embed_google_books');
function sc_embed_google_books( $atts ){
extract(shortcode_atts(array(
"id" => '',
"width" => '600',
"height" => '900',
), $atts));
return '<script type="text/javascript" src="http://books.google.com/books/previewlib.js"></script>
<script type="text/javascript">
GBS_insertPreviewButtonPopup("'.$id.'", '.$width.','.$height.');
</script>';
}
function get_google_tag( $isbn_metadata ) {
return (
/* '<span class="post-meta-key">Preview: </span>' . */
'<script type="text/javascript" src="http://books.google.com/books/previewlib.js"></script>' .
'<script type="text/javascript">' .
'GBS_insertPreviewButtonPopup(\'ISBN:' . $isbn_metadata . '\');' .
'</script>'
);
}
?>
if(!function_exists())
condition. If not, you cannot just copy a function to the child theme. This will trigger a cannot redeclare fatal error. No 2 functions can have the same name, except under the condition as stated. Turn on debug in wp-config.php