WordPress.org

Ready to get started?Download WordPress

Forums

Broken dashboard after adding project (4 posts)

  1. edwardgyngell
    Member
    Posted 1 year ago #

    Hello, I am building a personal portfolio site.

    My admin section was working fine and I was adding in a few projects and giving them feature images. Then for some reason when I went to add another one it just suddenly broke. I hadn't changed any php only css. I have undone some of the last lines on code I type in the index page but it was not the problem.

    This is the error message i am getting:

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/portfolio/wp-content/themes/edwardgyngell/posttypes.php:39) in /Applications/XAMPP/xamppfiles/htdocs/portfolio/wp-includes/pluggable.php on line 881

    Can any help me please?

    This is my index page:

    <?php get_header(); ?>
    <div class="container">
    	<div id="contentwrap">
            <div id="masonry-index">
    				<?php
    
                    global $query_string;
                    query_posts($query_string . "post_type=projects&post_status=publish&posts_per_page=50");
                    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
                    <div class="project">
                        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                            <?php the_post_thumbnail(); ?>
                            <h2><?php the_title(); ?></h2>
                        </a>
                    </div>
    
                    <?php endwhile;
                    endif; ?>
    
            </div> <!-- End of content -->
    	</div><!-- End of container -->
    </div> <!-- End of profile -->
    <?php get_footer(); ?>
    This is my posttypes.php

    // Add new post type for Projects

    add_action ('init', 'projects_init');
    function projects_init()
    {
    		$project_labels = array(
    			'name' => _x('Projects', 'post type genral name'),
    			'singular_name' => _x('Project', 'post type singular name'),
    			'all_items' => __('All Projects'),
    			'add_new' => _x('Add new project', 'projects'),
    			'add_new_item' => __('Add new project'),
    			'edit_item' => __('Edit project'),
    			'new_item' => __('New project'),
    			'view_item' => __('View project'),
    			'search_item' => __('Search in projects'),
    			'not_found' => __('No projects found'),
    			'not_found_in_trash' => __('No projects found in trash'),
    			'parent_item_colon' => ''
    		);
    
    		$args = array(
    			'labels' => $project_labels,
    			'public' => true,
    			'publicly_queryable' => true,
    			'show_ui' => true,
    			'query_var' => true,
    			'rewrite' => true,
    			'capability_type' => 'post',
    			'hierarchical' => false,
    			'menu_position' => 5,
    			'supports' => array('title', 'editor','thumbnail', 'excerpt', 'custom-fields')
    		);
    		register_post_type('projects',$args);
  2. Roy
    Member
    Posted 1 year ago #

  3. edwardgyngell
    Member
    Posted 1 year ago #

    Thanks for the reply.

    I fixed my dashboard but I am getting these error when dealing with the image upload and delete feature.

    It says

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/portfolio/wp-content/themes/edwardgyngell/posttypes.php:39) in /Applications/XAMPP/xamppfiles/htdocs/portfolio/wp-includes/pluggable.php on line 881

    Any suggestion?

  4. edwardgyngell
    Member
    Posted 1 year ago #

    my wp-config file did no contain a

    ?> at the end. Should it? I tried it will but it did not resolve my problem.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.