[ create a new paste ] login | about

Link: http://codepad.org/JMOzlOov    [ raw code | output | fork ]

jonedwards - PHP, pasted on Jul 26:
<?php

// theme setup
add_action( 'after_setup_theme', 'eclb_theme_setup' );

function eclb_theme_setup() {
	global $content_width;

	/* Set the $content_width for things such as video embeds. */
	if ( !isset( $content_width ) )
		$content_width = 640;
	
	/* Add theme support for automatic feed links. */
	add_theme_support( 'automatic-feed-links' );

	/* Add theme support for post thumbnails (featured images). */
	add_theme_support( 'post-thumbnails' );

	// Set the image sizes for post thumbnails
	add_image_size('blog-thumb', 130, 110, true);
	add_image_size('blog-full', 630, 210, true);
	
	/* Add your nav menus function to the 'init' action hook. */
	add_action( 'init', 'eclb_register_menus' );

	/* Add your sidebars function to the 'widgets_init' action hook. */
	add_action( 'widgets_init', 'eclb_register_sidebars' );

	/* Load JavaScript files on the 'template_rediret' action hook. */
	add_action( 'template_redirect', 'eclb_load_scripts' );
}

function eclb_register_menus() {
	/* Register nav menus using register_nav_menu() or register_nav_menus() here. */
	// register wordpress custom menus
	register_nav_menus(
		array(
			'primary-menu' => __('Primary Menu')
			)
		)
	;
}

// register custom post types
	// register downloads
    add_action( 'init', 'register_cpt_downloads' );
    function register_cpt_downloads() {
    $labels = array(
    'name' => _x( 'Downloads', 'downloads' ),
    'singular_name' => _x( 'Download', 'downloads' ),
    'add_new' => _x( 'Add New', 'downloads' ),
    'add_new_item' => _x( 'Add New Download', 'downloads' ),
    'edit_item' => _x( 'Edit Download', 'downloads' ),
    'new_item' => _x( 'New Download', 'downloads' ),
    'view_item' => _x( 'View Download', 'downloads' ),
    'search_items' => _x( 'Search Downloads', 'downloads' ),
    'not_found' => _x( 'No downloads found', 'downloads' ),
    'not_found_in_trash' => _x( 'No downloads found in Trash', 'downloads' ),
    'parent_item_colon' => _x( 'Parent Download:', 'downloads' ),
    'menu_name' => _x( 'Downloads', 'downloads' ),
    );
    $args = array(
    'labels' => $labels,
    'hierarchical' => true,
    'supports' => array( 'title', 'editor', 'excerpt' ),
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'publicly_queryable' => true,
    'exclude_from_search' => false,
    'has_archive' => true,
    'query_var' => true,
    'can_export' => true,
    'rewrite' => true,
    'capability_type' => 'post'
    );
    register_post_type( 'downloads', $args );
    }
    
	// register vacancies
    add_action( 'init', 'register_cpt_vacancies' );
    function register_cpt_vacancies() {
    $labels = array(
    'name' => _x( 'Vancancies', 'vacancies' ),
    'singular_name' => _x( 'Vacancy', 'vacancies' ),
    'add_new' => _x( 'Add New', 'vacancies' ),
    'add_new_item' => _x( 'Add New Vacancy', 'vacancies' ),
    'edit_item' => _x( 'Edit Vacancy', 'vacancies' ),
    'new_item' => _x( 'New Vacancy', 'vacancies' ),
    'view_item' => _x( 'View Vacancy', 'vacancies' ),
    'search_items' => _x( 'Search Vancancies', 'vacancies' ),
    'not_found' => _x( 'No vancancies found', 'vacancies' ),
    'not_found_in_trash' => _x( 'No vancancies found in Trash', 'vacancies' ),
    'parent_item_colon' => _x( 'Parent Vacancy:', 'vacancies' ),
    'menu_name' => _x( 'Vancancies', 'vacancies' ),
    );
    $args = array(
    'labels' => $labels,
    'hierarchical' => true,
    'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'publicly_queryable' => true,
    'exclude_from_search' => false,
    'has_archive' => true,
    'query_var' => true,
    'can_export' => true,
    'rewrite' => true,
    'capability_type' => 'post'
    );
    register_post_type( 'vacancies', $args );
    }
    
    // register tenders
    add_action( 'init', 'register_cpt_tenders' );
    function register_cpt_tenders() {
    $labels = array(
    'name' => _x( 'Tenders', 'tenders' ),
    'singular_name' => _x( 'Tender', 'tenders' ),
    'add_new' => _x( 'Add New', 'tenders' ),
    'add_new_item' => _x( 'Add New Tender', 'tenders' ),
    'edit_item' => _x( 'Edit Tender', 'tenders' ),
    'new_item' => _x( 'New Tender', 'tenders' ),
    'view_item' => _x( 'View Tender', 'tenders' ),
    'search_items' => _x( 'Search Tenders', 'tenders' ),
    'not_found' => _x( 'No tenders found', 'tenders' ),
    'not_found_in_trash' => _x( 'No tenders found in Trash', 'tenders' ),
    'parent_item_colon' => _x( 'Parent Tender:', 'tenders' ),
    'menu_name' => _x( 'Tenders', 'tenders' ),
    );
    $args = array(
    'labels' => $labels,
    'hierarchical' => true,
    'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'publicly_queryable' => true,
    'exclude_from_search' => false,
    'has_archive' => true,
    'query_var' => true,
    'can_export' => true,
    'rewrite' => true,
    'capability_type' => 'post'
    );
    register_post_type( 'tenders', $args );
    }

function eclb_register_sidebars() {
	/* Register dynamic sidebars using register_sidebar() here. */
	// Footer: Corporate Links
	register_sidebar(array(
		'name' => 'Footer Corporate Links', 
		'id'   => 'footer-corporate-links', 
		'description'   => 'Widgetized area for corporate links rotator in the footer.', 
		'before_widget' => '', 
		'after_widget'  => '', 
		'before_title'  => '', 
		'after_title'   => '' 
	));
	// Footer: Calendar
	register_sidebar(array(
		'name' => 'Footer Calendar', 
		'id'   => 'footer-calendar', 
		'description'   => 'Widgetized area for the events calendar in the footer.', 
		'before_widget' => '', 
		'after_widget'  => '', 
		'before_title'  => '', 
		'after_title'   => '' 
	));
	// Footer: Helpline
	register_sidebar(array(
		'name' => 'Footer Helpline', 
		'id'   => 'footer-helpline', 
		'description'   => 'Widgetized area for helpline number in the footer.', 
		'before_widget' => '', 
		'after_widget'  => '', 
		'before_title'  => '', 
		'after_title'   => '' 
	));
	// Footer: Corporate Links
	register_sidebar(array(
		'name' => 'Footer Contact Details', 
		'id'   => 'footer-contact-details', 
		'description'   => 'Widgetized area for contact details in the footer.', 
		'before_widget' => '', 
		'after_widget'  => '', 
		'before_title'  => '', 
		'after_title'   => '' 
	));
	// Footer: Copyright Notice
	register_sidebar(array(
		'name' => 'Footer Copyright', 
		'id'   => 'footer-copyright', 
		'description'   => 'Widgetized area for copyright notice in the footer.', 
		'before_widget' => '', 
		'after_widget'  => '', 
		'before_title'  => '', 
		'after_title'   => '' 
	));
}

function eclb_load_scripts() {
	/* Enqueue custom Javascript here using wp_enqueue_script(). */
	
	// threaded comments script
	if (!is_admin()) {
		if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
			wp_enqueue_script('comment-reply');
	}
	
	if (!is_admin()) {
	wp_deregister_script('jquery');
	wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"), false);
	wp_enqueue_script('jquery');
	}
	
}

// limit words outputted in string
function string_limit_words($string, $word_limit)
{
  $words = explode(' ', $string, ($word_limit + 1));
  if(count($words) > $word_limit) {
  array_pop($words);
  //add a ... at last article when more than limit word count
  echo implode(' ', $words)."..."; } else {
  //otherwise
  echo implode(' ', $words); }
}

// read more
function new_excerpt_more($more) {
       global $post;
	return '&hellip;';
}
add_filter('excerpt_more', 'new_excerpt_more');

// remove some head items
function removeHeadLinks() {
	remove_action('wp_head', 'rsd_link');
	remove_action('wp_head', 'wlwmanifest_link');
}
add_action('init', 'removeHeadLinks');
remove_action('wp_head', 'wp_generator');

?>


Output:
1
2

Fatal error: Call to undefined function add_action() on line 4


Create a new paste based on this one


Comments: