Problems with a custom meta_box

You are not including any previously set values in the input field. $value = get_post_meta($post_id->ID,’event-link’,true); <input type=”text” style=”padding:10px;” value=”‘.$value.'” name=”event-link”/> Note that the meta box callback get a post object not just an ID. Additionally, you are not saving your fields at all. Instead you are saving either 1 or 0. If you want to … Read more

Add custom taxonomies as class names to an archive page of custom post types

The function you mention is going to return a list of links — aren’t you just trying to get the term slug as a class? Why not do…. $terms = get_the_terms($post->ID, ‘my-category’); $more_terms = get_the_terms($post->ID, ‘another-category’); $slug_out = array(); foreach($terms as $term){ $slug_out[] = $term->slug; } foreach($more_terms as $term){ $slug_out[] = $term->slug; } echo ‘<div … Read more

How to output the content of a Custom Post Type from a drop down form?

This is going to be 1 part processing an array, and 1 part jQuery. <?php // assume you have a loop already $html_out=””; $select=”<select id=”office-chooser”>”; $select .= ‘<option value=””>Select an Office</option>’; while($loop->have_posts()) : $loop->the_post(); // add each div with excerp. It’s ID is unique and correlates to value of select drop down $html_out .= ‘<div … Read more

How to filter posts by categories?

From Isotope Docs: HTML: <ul id=”filters”> <li><a href=”#” data-filter=”*”>show all</a></li> <li><a href=”#” data-filter=”.metal”>metal</a></li> <li><a href=”#” data-filter=”.transition”>transition</a></li> <li><a href=”#” data-filter=”.alkali, .alkaline-earth”>alkali and alkaline-earth</a></li> <li><a href=”#” data-filter=”:not(.transition)”>not transition</a></li> <li><a href=”#” data-filter=”.metal:not(.transition)”>metal but not transition</a></li> </ul> <div id=”container”> <div class=”element transition metal”>…</div> <div class=”element post-transition metal”>…</div> <div class=”element alkali metal”>…</div> <div class=”element transition metal”>…</div> <div class=”element lanthanoid metal … Read more