I really haven't got a clue here.

I've been busily developing a custom WordPress site, using custom plugins and widgets for some of the custom functionality, and I've hit a snag.

No matter what I do, I can't get the widget in the plugin below to run AT ALL.


The plugin is structured in EXACTLY the same way as another, very similar plugin that DOES work. I've copied and pasted the widget functionality onto the theme page itself, so I know it works. I've tried echoing out some debugs and can't even get those to show up. The widget is just straight-up refusing to run at all - but the custom post type is being registered, so this plugin IS running, just not the widget component.

Oh, and there IS a valid plugin declaration at the top of the page, I just didn't copy+paste it here.

Any help at all would be appreciated at this point!

EDIT: Let me clarify even more. The widget itself actually shows up in Appearance > Widgets. But on the page itself, nothing displays, not even the echoes.

EDIT: It was requested I paste the code here. It can be found below:


    // add the project post type
    add_action('init', 'codex_news_release_init');
    // change the default WordPress messages associated with this post type
    add_filter('post_updated_messages', 'codex_news_release_updated_messages');

    // this action calls the function to register the widget functionality and controls
    add_action("plugins_loaded", "widget_news_releases_manager_init");

    // this function registers the widget functionality and controls
    function widget_news_releases_manager_init() {
                    __('All News Releases'), 'widget_all_news_releases');


    // this function will register the 'News Release' post type and...
    // ...change some of the default button text to reflect it.
    function codex_news_release_init() {

            $labels = array(
                    'name' => _x('News Release', 'post type general name'),
                    'singular_name' => _x('News Release', 'post type singular name'),
                    'menu_name' => _x('News Releases', 'admin menu'),
                    'name_admin_bar' => _x('News Release', 'add new on admin bar'),
                    'add_new' => _x('Add New', 'news_release'),
                    'add_new_item' => __('Add New News Release'),
                    'new_item' => __('New News Release'),
                    'edit_item' => __('Edit News Release'),
                    'view_item' => __('View News Release'),
                    'all_items' => __('All News Releases'),
                    'search_items' => __('Search News Releases'),
                    'parent_item_colon' => __('Parent News Releases:'),
                    'not_found' => __('No news releases found.'),
                    'not_found_in_trash' => __('No news releases found in Trash.')

        $args = array(
          'public' => true,
          'labels'  => $labels,
          'rewrite' => array('slug' => 'news_release'),
          'supports' => array('title'),

        register_post_type( 'news_release', $args );

    // this function will change the default WordPress messages associated with this post type...
    // ...from generic 'post updated', for example, to a more appropriate 'news release updated'
    function codex_news_release_updated_messages($messages) {

            $post = get_post();
            $post_type = get_post_type( $post );
            $post_type_object = get_post_type_object( $post_type );

            $messages['news_release'] = array(
                    0  => '', // Unused. Messages start at index 1.
                    1  => __('News Release updated.'),
                    2  => __('Custom field updated.'),
                    3  => __('Custom field deleted.'),
                    4  => __('News Release updated.'),
                    /* translators: %s: date and time of the revision */
                    5  => isset($_GET['revision'] ) ? sprintf( __( 'News Release restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
                    6  => __('News Release published.'),
                    7  => __('News Release saved.'),
                    8  => __('News Release submitted.'),
                    9  => sprintf(
                            __( 'News Release scheduled for: <strong>%1$s</strong>.'),
                            // translators: Publish box date format, see http://php.net/date
                            date_i18n( __( 'M j, Y @ G:i'), strtotime( $post->post_date ) )
                    10 => __( 'News Release draft updated.')

            if ( $post_type_object->publicly_queryable ) {
                    $permalink = get_permalink( $post->ID );

                    $view_link = sprintf(' <a href="%s">%s</a>', esc_url($permalink ), __('View news release'));
                    $messages[$post_type][1] .= $view_link;
                    $messages[$post_type][6] .= $view_link;
                    $messages[$post_type][9] .= $view_link;

                    $preview_permalink = add_query_arg('preview', 'true', $permalink);
                    $preview_link = sprintf(' <a target="_blank" href="%s">%s</a>', esc_url($preview_permalink ), __('Preview news release'));
                    $messages[$post_type][8]  .= $preview_link;
                    $messages[$post_type][10] .= $preview_link;

            return $messages;


    function widget_all_news_releases(){
            echo "WAAAAZZZZUP???!?!?!!!?!?";
            wp_enqueue_style('all-news-releases-style', plugins_url('styles/all_news_releases_style.css', __FILE__));


    function display_all_news_releases(){

                            $args = array(
                                    'posts_per_page' => -1,
                                    'post_type' => 'news_release',
                                    'post_status' => 'publish'


                            $i = 0;
                            while (have_posts()) : the_post(); ?>

                                            if($i % 2 == 0){
                                                    $open = false;
                                                    $close = true;
                                            } else {
                                                    $open = true;
                                                    $close = false;

                                            $custom_fields = get_post_custom();

                                    <?php if($open == true) : ?>
                                            <div class="row even_less_padding">
                                    <?php endif; ?>

                                    <div class="small-12 large-6 columns">
                                            <a target="_blank" href="<?php the_permalink(); ?>">
                                                    <h4 class="small_story_head blue_dark"><?php the_title(); ?></h4>

                                    <?php if($open == false) : ?>
                                    <?php endif; ?>

                            <?php endwhile;

                            if($i % 2 != 0) : ?>
                            <?php endif;


  • I test your code and it work good. maybe another plugin interfer, have you try do descativate all other plugins and theme ?
    – mmm
    Commented Aug 5, 2015 at 21:00
  • Add your code inside your question, do not use third party services for code. If the paste ever get removed, then your question will be useless to others. Also, it is realy realy frustrating having to open multiple windows to read one post :-) Commented Aug 6, 2015 at 5:50
  • Thanks for the tip - I added the code into the post. I also tested with all other plugins off, same result.
    – CGriffin
    Commented Aug 6, 2015 at 14:07

1 Answer 1



Double check your uploads paths before spending hours trying to find a bug. 'wp-content/plugin', incidentally, is not the correct upload path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.