Nikolay Shipilin - designer

My First attempt at public speaking #WordCampSacramento


If you have not spoken publicly before – you may think you understand. If you have, thank you for understanding…
How was it?
What did I miss?
How red is my face?
I answered all of those questions during the speech… But I loved it.
I had an honor to speak right next to some of the highest authorities in WordPress world. Guys like Chris Lema spoke and then they let me out… Everyone in the crowd was like, “who is this guy?” Well, at least that is what I felt for the first few seconds. The crowd melted down once I dropped my ridiculous Russian accent and went along with my normal Russian accent. Because I was so nervous I probably skipped half the things I wanted to introduce and describe in details, but it is only my first experience. By the way, if anyone needs help with WordPress or liked what I spoke on, feel free to contact me. I’m glad to help – always.


Now, to add some science to the topic of my speech. The lecture meant to, but I’m certain it didn’t cover all the wonderful benefits of Custom Post Types in WordPress. They are really a simple and clever solution which helps organizing the data and simplifying the content management. Every entry in the database in order to be searched and retrieved efficiently needs a unique index and better yet a second identifier which categorizes it. “post_type” is a column in `wp_posts` table (that is if your prefix is “wp_”, which is a bad idea) and it makes the custom SQL queries easier.

For example, if you have to retrieve a random testimonial which is organized in a custom post type called “testimonial” you would use a function called WP_Query and write the following:

$args = array('post_type' => 'testimonial', 'posts_per_page' => 1, 'orderby' => 'rand');
$random_testimonial = new WP_Query( $args );

That will give you the OBJECT with really only one post(testimonial) in it. Then you would have to run in through the regular “while” loop and output your random testimonial.

<?php if ( $random_testimonial->have_posts() ){
    // Start the Loop.
    while ( $random_testimonial->have_posts() ) : $random_testimonial->the_post();?>
      <h3><?php the_title(); ?></h3>
      <?php the_content(); ?>
<?  endwhile;
wp_reset_query(); // don't forget this part if you have other queries on the page


Now, you might think “I’m not a coder, how does this benefit me?”
In that case, at the very least you will get the dashboard menu called “Testimonials” with its own icon and slug (url path) reserved in your site structure.
Using some widget from Appearance->Widgets, you can bring that random testimonial into a sidebar or footer or any other part of your current theme. There, I said it – none coders can register and use custom post types. If you still don’t understand – watch the video again and read the article one more time. This continues until you do…