Category: WordPress

  • Register a shortcode for a scrollbox

    <?php // function that runs when shortcode is called function dk_c3scrollbox_shortcode() { // Things that you want to do. $message = ‘Hello world!’; // Output needs to be return return $message; } // register shortcode add_shortcode(‘c3scrollbox’, ‘wpb_demo_shortcode’); <?php //Register Shortcodes add_action( ‘init’, ‘register_shortcodes’); function register_shortcodes(){ add_shortcode(‘c3scrollbox’, ‘c3scrollbox_function’); } //Display Shortcodes function c3scrollbox_function($atts, $content = null){…

  • Check and Delete All Ungraded Submitted Essays with Score 0

    allInputNodeList = document.querySelectorAll(‘input[type=”number”]’); for (var i=0;i<allInputNodeList.length; i++){ if (allInputNodeList[i].value == 0){ var inputName = allInputNodeList[i].name; var checkboxName = inputName.replace(“essay_points”,”cb-select-“); checkboxName = checkboxName.replace(“[“,””); checkboxName = checkboxName.replace(“]”,””); document.getElementById(checkboxName).checked = true; } }

  • Remove WP Header Bloat

  • Contact Form 7 Event tracking + Google AdWords pixel

    document.addEventListener( ‘wpcf7submit’, function( event ) { //GA ga(‘mer_ga.send’, {hitType: ‘event’,eventCategory: ‘Contact Form Submission’,eventAction: location.pathname,eventLabel: document.title }); //Hardcoded GA AdWords tag new Image().src = “//www.googleadservices.com/pagead/conversion/” + “942367574” + “/?value=” + “0” + “&label=” + “D6KeCKj7nG4Q1satwQM” + “&guid=ON&script=0″; document.write(‘<script type=”text/javascript” src=”//www.googleadservices.com/pagead/conversion_async.js”></script>’); console.log(‘document.write googleadservices.com/’); //goog_report_conversion(document.location); console.log(‘Calling goog_report_conversion’); }, false );

  • WordPress custom function.php nag removal function

    <?php function remove_core_updates(){ global $wp_version;return(object) array(‘last_checked’=> time(),’version_checked’=> $wp_version,); } add_filter(‘pre_site_transient_update_core’,’remove_core_updates’); add_filter(‘pre_site_transient_update_plugins’,’remove_core_updates’); add_filter(‘pre_site_transient_update_themes’,’remove_core_updates’); ?>

  • Search/Replace WordPress [functions.php]

    add_filter(‘gettext’, ‘translate_text’); add_filter(‘ngettext’, ‘translate_text’); function translate_text($translated) { $translated = str_ireplace(‘Related Products’, ‘Related Recipes’, $translated); return $translated; }

  • WordPress remove nag

    function remove_core_updates(){ global $wp_version;return(object) array(‘last_checked’=> time(),’version_checked’=> $wp_version,); } add_filter(‘pre_site_transient_update_core’,’remove_core_updates’); add_filter(‘pre_site_transient_update_plugins’,’remove_core_updates’); add_filter(‘pre_site_transient_update_themes’,’remove_core_updates’);

  • Accessing WordPress outside WordPress CMS

  • WordPress Shortcodes