<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<?php $theme_options = pcomm_get_theme_options(); echo $theme_options["pcomm_analytics_tracking_id"]; ?> ', '<?php echo $_SERVER["SERVER_NAME"]; ?> '); ga('send', 'pageview'); </script>
function pcomm_add_body_class($classes) { global $post; // gets theme options, set in theme-options.php $theme_options = pcomm_get_theme_options(); // if there's a namespace, add it the body class $classes[] = $theme_options['pcomm_theme_namespace']; if (isset($post)) { $classes[] = $post->post_type . '_' . $post->post_name; } if (is_single()) { foreach (wp_get_post_terms($post->ID) as $term) { // add category slug to the $classes array $classes[] = $term->slug; } foreach (wp_get_post_categories($post->ID, array('fields' => 'slugs')) as $category) { // add category slug to the $classes array $classes[] = $category; } } return $classes; }
/** * Renders the sample textarea setting field. */ function pcomm_settings_field_sample_textarea() { $options = pcomm_get_theme_options(); ?> <textarea class="large-text" type="text" name="pcomm_theme_options[sample_textarea]" id="sample-textarea" cols="50" rows="10" /><?php echo esc_textarea($options['sample_textarea']); ?> </textarea> <label class="description" for="sample-textarea"><?php _e('Sample textarea', 'pcomm'); ?> </label> <?php }