functions.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. function custom_excerpt_length( $length ) {
  3. return 30;
  4. }
  5. /*function yakidoo_theme_setup() {
  6. }
  7. add_action( 'after_setup_theme', 'yakidoo_theme_setup' );*/
  8. add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  9. add_theme_support( 'post-thumbnails' ); // enable post thumbnails
  10. set_post_thumbnail_size( 300, 200, true );
  11. add_image_size("featured", 263, 250, true);
  12. add_image_size("featured-wide", 555, 250, true);
  13. function register_my_menus() {
  14. register_nav_menus(
  15. array(
  16. 'header-menu' => __( 'Header Menu' ),
  17. 'header-sub-menu' => __( 'Header Sub-menu' )
  18. )
  19. );
  20. }
  21. add_action( 'init', 'register_my_menus' );
  22. function yakidoo_widgets_init() {
  23. register_sidebar( array(
  24. 'name' => __( 'Main Sidebar', 'theme-slug' ),
  25. 'id' => 'sidebar-1',
  26. 'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'theme-slug' ),
  27. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  28. 'after_widget' => '</li>',
  29. 'before_title' => '<h2 class="widgettitle">',
  30. 'after_title' => '</h2>',
  31. ) );
  32. }
  33. add_action( 'widgets_init', 'yakidoo_widgets_init' );
  34. class Yakidoo_Walker extends Walker {
  35. // Tell Walker where to inherit it's parent and id values
  36. var $db_fields = array(
  37. 'parent' => 'menu_item_parent',
  38. 'id' => 'db_id'
  39. );
  40. /**
  41. * At the start of each element, output a <li> and <a> tag structure.
  42. *
  43. * Note: Menu objects include url and title properties, so we will use those.
  44. */
  45. function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
  46. $output .= sprintf( "\n<li itemscope=\"itemscope\" itemtype=\"http://schema.org/SiteNavigationElement\"><a href='%s'%s itemprop=\"url\"><span itemprop=\"name\">%s</span></a></li>\n",
  47. $item->url,
  48. ( $item->object_id === get_the_ID() ) ? ' class="current"' : '',
  49. $item->title
  50. );
  51. }
  52. }
  53. ?>