I’m not sure how all of this code works exactly, but I was able to use it to remove the controls and title info by adding &showinfo=0&controls=0 to the youtube embeds on a website. /** * Add Custom Parameters to YouTube Embeds */ function namespace_oembed_youtube_no_title( $html, $url, $args ) { // Only run this for Read More…
This is how to change the default ‘posts’ to ‘videos’ and swap out the dashicon for the video icon <?php //Rename “Posts” to “Videos” add_action( ‘admin_menu’, ‘bigmoney_change_post_menu_label’ ); add_action( ‘init’, ‘bigmoney_change_post_object_label’ ); function bigmoney_change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = ‘Videos’; $submenu[‘edit.php’][5][0] = ‘Videos’; $submenu[‘edit.php’][10][0] = ‘Add Videos’; $submenu[‘edit.php’][16][0] = ‘Video Tags’; echo ”; Read More…
It turns out that WordPress has a set of built in dashicons that you can use in the backend dashboard, say for custom post types, or also on the frontend. It’s pretty cool. Check it out. Adding Dashicons in WordPress http://melchoyce.github.io/dashicons/
You can use this text to make a short page title. <?php $thetitle = get_the_title(); /* or you can use $post->post_title; */ $getlength = strlen($thetitle); $thelength = 25; echo substr($thetitle, 0, $thelength); if ($getlength > $thelength) echo “…”; ?> Or you can do add this to your functions.php file. function max_title_length($title){ $max = 20; return substr( Read More…
It turns out that you can’t actually use the <!–more–> tag in pages. Instead, you can use the <!–nextpage–> if you make sure to use the <?php wp_link_pages(); ?> php snippet. Take a look at the documentation to modify it. http://codex.wordpress.org/Template_Tags/wp_link_pages
This article is exactly what you need to exclude a category from the blog page. You just paste in the snippet into your functions.php file and viola. http://chriswiegman.com/2013/05/excluding-a-category-from-your-wordpress-homepage/ // Exclude category from homepage function my_exclude_category( $query ) { if ( $query->is_home ) { $query->set( ‘cat’, ‘-230’ ); } return $query; } add_filter( ‘pre_get_posts’, Read More…
This is the code I used to prepopulate a hidden field in Gravity Forms so that i could send users to different pages depending on what was in the field. /* CHECK FOR EVENTS and populate HIDDEN FIELD pre submission*/add_filter( “gform_pre_submission_23”, “check_for_events”, 9 );function check_for_events( $form ){ $ip=$_SERVER[“REMOTE_ADDR”]; //print_r($ip); exit(); $event_check = geoCheckIP($ip); //print_r($event_check[‘town’]. ‘, Read More…
WordPress has a built-in display categories widget that can show as a list or a dropdown. However, it only shows categories with posts attached to them. If you want to show all categories in a dropdown use this code. <form action=”<?php bloginfo(‘url’); ?>/” method=”get”> <?php $select = wp_dropdown_categories(‘show_option_none=Select State&show_count=1&orderby=name&echo=0&selected=0&hide_empty=0’); $select = preg_replace(“#<select([^>]*)>#”, “<select$1 onchange=’return this.form.submit()’>”, Read More…
This is some code that will help you to customize the password protected form. // change password protected text function my_password_form() { global $post; $label = ‘pwbox-‘.( empty( $post->ID ) ? rand() : $post->ID ); $o = __( “<p>In preparation for the Buying Summit we recommend you watch this incredible training from Matt Larson. Read More…