Forum Replies Created

Viewing 15 replies - 1 through 15 (of 38 total)
  • Thread Starter Tim W

    (@twalker123)

    On the website, https://www.cityofkeokuk.org, they have a poll that allows visitors to add their own answers. When users add a new answer, the poll results are reset to zero.

    I’m wondering if that is supposed to happen, or if there is an option somewhare that allows people to add new answers without resetting the previous votes.

    Thank you.

    Thread Starter Tim W

    (@twalker123)

    My best guess is that they tried to use incompatible javascript code, so when I took CustomPress out of the loop it was fine.

    Thread Starter Tim W

    (@twalker123)

    I wish I could explain, but nobody ever got back to me to tell me what the problem was, which is why I coded it myself.

    Tim

    Thread Starter Tim W

    (@twalker123)

    I’ve done several of them at this point, but here’s one we use for testimonials. I put the code in a plugin called nuggetweb-testimonials and I broke up the code in several files so it would be easier to maintain:

    nuggetweb-testimonials.php

    <?php
    /*
    Plugin Name: NuggetWeb Testimonials
    Plugin URI: https://NuggetWeb.com
    Description: Adds Testimonials post type to the NuggetWeb website.
    Version: 1.0
    Author: NuggetWeb.com
    Author URI: https://nuggetweb.com
    License: GPLv2
    */
    
    function testimonial_post_init() {
        $nw_post_type = array(
              'labels' => array (
                'name' => 'Testimonials',
                'singular_name' => 'Testimonial',
                'add_new_item' => 'Add New Testimonial',
                'edit_item' => 'Edit Testimonial',
                'new_item' => 'New Testimonial',
                'view_item' => 'View Testimonial',
                'search_items' => 'Search Testimonials',
                'not_found' => 'No Testimonials found',
                'not_found_in_trash' => 'No Testimonials found in trash',
              ),
              'taxonomies' => array('category'),
              'supports' =>
              array (
                'title' => 'title',
                'editor' => 'editor',
                'thumbnail' => 'thumbnail',
                'excerpt' => 'excerpt',
                //'trackbacks' => 'trackbacks',
                'custom_fields' => 'custom-fields',
                //'comments' => 'comments',
                'revisions' => 'revisions',
                'page_attributes' => 'page-attributes',
                'post_formats' => 'post-formats',
              ),
              'supports_reg_tax' =>
              array (
                'category' => '1',
                'post_tag' => '1',
              ),
              'capability_type' => 'post',
              'map_meta_cap' => true,
              'description' => 'Client Testimonials',
              'menu_position' => 20,
              'public' => true,
              'hierarchical' => false,
              'has_archive' => true,
              'rewrite' =>
              array (
                'with_front' => true,
                'feeds' => false,
                'pages' => true,
                'ep_mask' => 0,
              ),
              'query_var' => true,
              'can_export' => true,
              'cf_columns' => NULL,
              );
        register_post_type( 'testimonial', $nw_post_type );
    }
    add_action( 'init', 'testimonial_post_init' );
    
    function nuggetweb_remove_post_meta($post) {
        // Remove catagory from single post template
        if ( (get_post_type() == 'testimonial') && (is_single()) ) {
            ?>
            <style>div.post-meta { display: none; }
            <?php
        }
    }
    add_action('wp_head', 'nuggetweb_remove_post_meta');
    
    include 'nuggetweb-taxonomies.php';
    include 'nuggetweb-custom-metabox.php';
    /* include 'maps/nuggetweb-js.php';
    include 'nuggetweb-maps.php';  */
    
    ?>

    nuggetweb-taxonomies.php

    <?php
    
    // Add product types taxonomy
    function nuggetweb_custom_taxonomy() {
        // Taxonomies Export code for CustomPress
    
        $labels = array(
    		'name'              => 'Testimonial Types',
    		'singular_name'     => 'Testimonial Type',
    		'search_items'      => 'Search Testimonial Types',
    		'all_items'         => 'All Testimonial Types',
    		'parent_item'       => 'Parent Testimonial Type',
    		'parent_item_colon' => 'Parent Testimonial Type:',
    		'edit_item'         => 'Edit Testimonial Type',
    		'update_item'       => 'Update Testimonial Type',
    		'add_new_item'      => 'Add New Testimonial Type',
    		'new_item_name'     => 'New Testimonial Type',
    		'menu_name'         => 'Testimonial Types',
            'popular_items'     => 'Popular Testimonial Types',
            'add_or_remove_items'        => 'Add or remove testimonial Types',
            'separate_items_with_commas' => 'Separate testimonial types with commas',
            'choose_from_most_used'      => 'All testimonial Types',
    	);
    
    	$args = array(
    		'hierarchical'      => true,
    		'labels'            => $labels,
    		'show_ui'           => true,
    		'show_admin_column' => true,
    		'query_var'         => true,
    		'rewrite'           => array( 'slug' => 'testimonial-types' ),
    	);
        register_taxonomy( 'testimonial-types', array( 'testimonial' ), $args );
    }
    add_action( 'init', 'nuggetweb_custom_taxonomy', 0 );
    
    ?>

    nuggetweb-custom-metabox.php

    <?php
    
    /**
     * Adds a box to the main column on the post edit screens.
     */
    
    include 'include/nuggetweb-add-custom-metabox.php';
    
    /**
     * HTML for metaboxes on post add/edit screen.
     */
    
    include 'include/nuggetweb-show-custom-metabox.php';
    
    /**
     * Saves meta data
     */
    include 'include/nuggetweb-save-custom-metabox.php';
    
    ?>

    includes/nuggetweb-add-custom-metabox.php

    <?php
    
    function nuggetweb_add_custom_meta_box() {
        $nuggetweb_arrays = nuggetweb_get_array();
    
        foreach ($nuggetweb_arrays as $key => $arr ) {
            nuggetweb_add_custom_meta_box_function($key,$arr[0],$arr[1]);
        }
    }
    add_action( 'add_meta_boxes', 'nuggetweb_add_custom_meta_box' );
    
    function nuggetweb_add_custom_meta_box_function($id, $title, $callback) {
        $screen = 'testimonial';
        add_meta_box(
            $id,
            $title,
            $callback,
            $screen, // $page
            'normal', // $context
            'high' // $priority
    		);
    }
    
    function nuggetweb_get_array() {
        $nuggetweb_temp_array = array(  'nuggetweb_website_text'  => array('Website URL','show_custom_meta_box_website'),
                                  );
        return $nuggetweb_temp_array;
    }
    
    ?>

    includes/nuggetweb-save-custom-metabox.php

    <?php
    
    /**
     * When the post is saved, saves our custom data.
     *
     * @param int $post_id The ID of the post being saved.
     */
    function nuggetweb_save_testimonial_data( $post_id ) {
    
    	/*
    	 * We need to verify this came from our screen and with proper authorization,
    	 * because the save_post action can be triggered at other times.
    	 */
    
    	// Check if our nonce is set.
    	if ( ! isset( $_POST['website_nonce'] ) ) {
            return;
    	}
    
    	// Verify that the nonce is valid.
    	if ( ! wp_verify_nonce( $_POST['website_nonce'], 'nuggetweb_website_text' ) ) {
    		return;
    	}
    
    	// If this is an autosave, our form has not been submitted, so we don't want to do anything.
    	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
    		return;
    	}
    
    	// Check the user's permissions.
    	if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
    
    		if ( ! current_user_can( 'edit_page', $post_id ) ) {
    			return;
    		}
    
    	} else {
    
    		if ( ! current_user_can( 'edit_post', $post_id ) ) {
    			return;
    		}
    	}
    
    	/* OK, it's safe for us to save the data now. */
        $nuggetweb_arrays = nuggetweb_get_array();
    
        foreach ($nuggetweb_arrays as $key => $arr ) {
            //error_log("Saving \$key = $key, \$arr[1] = $arr[1], values = $_POST[$arr[1]]",0);
            nuggetweb_add_custom_save_box_function($key,$post_id);
        }
    
    }
    add_action( 'save_post', 'nuggetweb_save_testimonial_data' );
    
    function nuggetweb_add_custom_save_box_function($nuggetweb_field,$post_id) {
        if (! isset( $_POST[$nuggetweb_field] ))  {
    		//return;
    	}
        else {
            // Sanitize user input.
            $my_data = sanitize_text_field( $_POST[$nuggetweb_field] );
    
            // Update the meta field in the database.
    	    update_post_meta( $post_id, $nuggetweb_field, $my_data );
        }
    }
    ?>

    includes/nuggetweb-show-custom-metabox.php

    <?php
    
    function show_custom_meta_box_website( $post ) {
    
    	// Add an nonce field so we can check for it later.
    	wp_nonce_field( 'nuggetweb_website_text', 'website_nonce' );
    
    	/*
    	 * Use get_post_meta() to retrieve an existing value
    	 * from the database and use the value for the form.
    	 */
        $website = get_post_meta( $post->ID, 'nuggetweb_website_text', true );
    
    	echo '<label for="nuggetweb_website_text">';
    	_e( 'Address Line One', 'myplugin_textdomain' );
    	echo '</label> ';
    	echo '<input type="text" id="nuggetweb_website_text" name="nuggetweb_website_text" value="' . esc_attr( $website ) . '" size="25" />';
    }
    
    ?>

    I hope that helps!

    Thread Starter Tim W

    (@twalker123)

    I never got a response, so I had to get rid of CustomPress and write my own CPT code. Both companies charge for support and neither one provided it.

    Thread Starter Tim W

    (@twalker123)

    Hi Giorgio – yes, I created a plugin to add the CPT. I looked at some of the plugins that do it for you, but they’re really a lot more code than you need.

    Here is the code that creates the CPT:

    function site_post_init() {
        $nw_post_type = array(
              'labels' => array (
                'name' => 'Sites',
                'singular_name' => 'Site',
                'add_new_item' => 'Add New Site',
                'edit_item' => 'Edit Site',
                'new_item' => 'New Site',
                'view_item' => 'View Site',
                'search_items' => 'Search Sites',
                'not_found' => 'No sites found',
                'not_found_in_trash' => 'No sites found in trash',
              ),
              'taxonomies' => array('category'),
              'supports' =>
              array (
                'title' => 'title',
                'editor' => 'editor',
                'thumbnail' => 'thumbnail',
                'excerpt' => 'excerpt',
                'trackbacks' => 'trackbacks',
                'custom_fields' => 'custom-fields',
                'comments' => 'comments',
                'revisions' => 'revisions',
                'page_attributes' => 'page-attributes',
                'post_formats' => 'post-formats',
              ),
              'supports_reg_tax' =>
              array (
                'category' => '1',
                'post_tag' => '1',
              ),
              'capability_type' => 'post',
              'map_meta_cap' => true,
              'description' => 'NuggetWeb Websites',
              'menu_position' => 20,
              'public' => true,
              'hierarchical' => false,
              'has_archive' => true,
              'rewrite' =>
              array (
                'with_front' => true,
                'feeds' => false,
                'pages' => true,
                'ep_mask' => 0,
              ),
              'query_var' => true,
              'can_export' => true,
              'cf_columns' => NULL,
              );
        register_post_type( 'site', $nw_post_type );
    }
    add_action( 'init', 'site_post_init' );

    Here is the code for the meta boxes. It adds a field in the editor for the post type for the website URL:

    <?php
    
    /**
     * Adds a box to the main column on the Post and Page edit screens.
     */
    function nw_add_custom_meta_box() {
    
    	$screens = array( 'site' ); // add items to add to multiple post types
    
    	foreach ( $screens as $screen ) {
    		add_meta_box(
            'ct_Website_text_550e', // $id
            'Website', // $title
            'show_custom_meta_box', // $callback
            $screen, // $page
            'normal', // $context
            'high' // $priority
    		);
    	}
    }
    add_action( 'add_meta_boxes', 'nw_add_custom_meta_box' );
    
    /**
     * Prints the box content.
     *
     * @param WP_Post $post The object for the current post/page.
     */
    function show_custom_meta_box( $post ) {
    
    	// Add an nonce field so we can check for it later.
    	wp_nonce_field( 'ct_Website_text_550e', 'website_nonce' );
    
    	/*
    	 * Use get_post_meta() to retrieve an existing value
    	 * from the database and use the value for the form.
    	 */
    	$value = get_post_meta( $post->ID, 'ct_Website_text_550e', true );
    
    	echo '<label for="ct_Website_text_550e">';
    	_e( 'Website Address', 'myplugin_textdomain' );
    	echo '</label> ';
    	echo '<input type="text" id="ct_Website_text_550e" name="ct_Website_text_550e" value="' . esc_attr( $value ) . '" size="25" />';
    }
    
    /**
     * When the post is saved, saves our custom data.
     *
     * @param int $post_id The ID of the post being saved.
     */
    function nuggetweb_save_meta_box_data( $post_id ) {
    
    	/*
    	 * We need to verify this came from our screen and with proper authorization,
    	 * because the save_post action can be triggered at other times.
    	 */
    
    	// Check if our nonce is set.
    	if ( ! isset( $_POST['website_nonce'] ) ) {
    		return;
    	}
    
    	// Verify that the nonce is valid.
    	if ( ! wp_verify_nonce( $_POST['website_nonce'], 'ct_Website_text_550e' ) ) {
    		return;
    	}
    
    	// If this is an autosave, our form has not been submitted, so we don't want to do anything.
    	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
    		return;
    	}
    
    	// Check the user's permissions.
    	if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
    
    		if ( ! current_user_can( 'edit_page', $post_id ) ) {
    			return;
    		}
    
    	} else {
    
    		if ( ! current_user_can( 'edit_post', $post_id ) ) {
    			return;
    		}
    	}
    
    	/* OK, it's safe for us to save the data now. */
    
    	// Make sure that it is set.
    	if ( ! isset( $_POST['ct_Website_text_550e'] ) ) {
    		return;
    	}
    
    	// Sanitize user input.
    	$my_data = sanitize_text_field( $_POST['ct_Website_text_550e'] );
    
    	// Update the meta field in the database.
    	update_post_meta( $post_id, 'ct_Website_text_550e', $my_data );
    }
    add_action( 'save_post', 'nuggetweb_save_meta_box_data' );
    
    ?>

    This is the code for the CPT taxonomy:

    <?php
    
    // Add product types taxonomy
    function nw_custom_taxonomy() {
        // Taxonomies Export code for CustomPress
    
        $labels = array(
    		'name'              => 'Product Types',
    		'singular_name'     => 'Product Type',
    		'search_items'      => 'Search Product Types',
    		'all_items'         => 'All Product Types',
    		'parent_item'       => 'Parent Product Type',
    		'parent_item_colon' => 'Parent Product Type:',
    		'edit_item'         => 'Edit Product Type',
    		'update_item'       => 'Update Product Type',
    		'add_new_item'      => 'Add New Product Type',
    		'new_item_name'     => 'New Product Type',
    		'menu_name'         => 'Product Types',
            'popular_items'     => 'Popular Product Types',
            'add_or_remove_items'        => 'Add or remove Product Types',
            'separate_items_with_commas' => 'Separate product types with commas',
            'choose_from_most_used'      => 'All Product Types',
    	);
    
    	$args = array(
    		'hierarchical'      => false,
    		'labels'            => $labels,
    		'show_ui'           => true,
    		'show_admin_column' => true,
    		'query_var'         => true,
    		'rewrite'           => array( 'slug' => 'product-types' ),
    	);
        register_taxonomy( 'product-types', array( 'site' ), $args );
    }
    add_action( 'init', 'nw_custom_taxonomy', 0 );
    
    ?>

    I hope that helps!

    Tim

    Thread Starter Tim W

    (@twalker123)

    Yep. Thanks again!

    Thread Starter Tim W

    (@twalker123)

    Got it! Thanks for all of your help d4z_c0nf, Giorgio and nikeo!

    https://dev.nuggetweb.com/clients/

    Here is the final page template code from d4z_c0nf (modified for my CPT) that I have working. I called it page-template-client.php:

    <?php
    /*
    Template Name: Clients
     */
    
    /* I use the action hook __after_loop
     * and partially replicate the customizr loop
     * to achieve:
     * 1) keep the page title
     * 2) show the page content if any, this can be used as a summary
     * before the list of posts
     */
    add_action('__after_loop', 'clients_list', 0);
    function clients_list(){
        add_filter('the_title', 'link_title_to_site', 0);
    
        global $wp_query;
        $wp_query = new WP_Query(array(
            /* change this with the query vars you need to display your cpts */
                'paged' => get_query_var('paged'),
                'post_type' => 'site'
            )
        );
        if ( have_posts() ) :
            while ( have_posts() ) :
                the_post();
                do_action ('__before_article');
                ?>
                    <article <?php tc__f('__article_selectors') ?>>
                        <?php do_action( '__loop' ); ?>
                    </article>
                <?php
                do_action ('__after_article'); 
    
            endwhile;
         endif; ##end if have posts
    }
    
    function site_link(){
        global $post;
        $href = get_post_meta($post->ID,'ct_Website_text_550e',true);
        return $href;
    }
    
    /* the title link */
    function link_title_to_site($title){
        /* your code to wrap the title into a link */
        return sprintf('<a href="%1$s" title="%2$s" target="_blank">%3$s</a>',
            site_link(),
            sprintf( __("Go to %s"), $title ),
            $title
        );
    }
    add_filter('tc_post_thumb_wrapper', 'change_thumbnails_link');
    function change_thumbnails_link($thumb){
        return preg_replace('/<a(.*?)href="(.*?)"(.*?)>/',
            '<a\1href="'.site_link().'"\3>',
            $thumb
        );
    }
    /*
     * in order to have the navigator we have to reset the custom query
     * with priority 30 (navigation has priority 20)
     */
    add_action('__after_loop', 'reset_query', 25);
    function reset_query(){
        global $wp_query, $wp_the_query;
        $wp_query = $wp_the_query;
    }
    
    /* let's remove customizr title filter on the title */
    remove_filter('the_title', array(TC_Headings::$instance, 'tc_content_heading_title'), 0);
    /* uncomment line below if you want to get rid of comments bubble */
    //remove_filter('the_title', array(TC_Headings::$instance, 'tc_add_comment_bubble_after_title'), 1);
    /* uncomment line below if you want to get rid of edit link */
    //remove_filter('the_title', array(TC_Headings::$instance, 'tc_add_edit_link_after_title'), 2);
    
    /*
     * let's include customizr index.php
     * this way we'll not lose eventual
     * changes on it
     */
    include_once( TC_BASE . 'index.php' );

    Tim

    Thread Starter Tim W

    (@twalker123)

    I see what you mean – you’re right!

    I’m going to knock off for the night, but I’m going to have to figure that out. Thanks for all of your help, I really appreciate it!

    Tim

    Thread Starter Tim W

    (@twalker123)

    DOH! You’re right. I started with the free version and changed the path to style.css but forgot the template tag. AAARRRRGGG! I’m so sorry about that!

    I’m not sure what you mean by this…

    That said, you clearly have something, somewhere, which prints out the custom post in the way you see it.
    <img src=”https://i57.tinypic.com/a3nnlt.jpg&#8221; border=”0″ alt=”Image and video hosting by TinyPic”>”>Here an example of the code above showing one of your custom posts with title, site link (ct_Website_text_550e), and thumbnail.

    Thread Starter Tim W

    (@twalker123)

    According to the readme, I’m using Customizr Pro version 1.0.4 (just downloaded it from them last Thursday).

    I had already tried removing that filter as well (not quite so eloquently) but it didn’t make a difference for me either. Giorgio tried messing with it in a previous post as well and it threw him too.

    The custom meta box is dealt with in a separate part of the plugin. It’s not really created when the CPT is, so I kept is separate:

    add_meta_box(
            'ct_Website_text_550e', // $id
            'Website', // $title
            'show_custom_meta_box', // $callback
            'site', // $page
            'normal', // $context
            'high' // $priority
    		);

    Here is the loop from our current theme so you can see how it’s being linked:

    <?php while ( have_posts() ) : the_post(); ?>
    
    		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    			<div class="entry-utility">
    				<?php if ( comments_open() || ( '0' != get_comments_number() && ! comments_open() ) ) : ?>
    					<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'nuntius' ), __( '1 Comment', 'nuntius' ), __( '% Comments', 'nuntius' ) ); ?></span>
    				<?php endif; ?>
    				<?php edit_post_link( __( 'Edit', 'nuntius' ), '<span class="edit-link">', '</span>' ); ?>
    			</div><!-- .entry-utility -->
    
    			<a href="<?php echo get_post_meta($post->ID,'ct_Website_text_550e',true) ?>" rel="bookmark" target="_blank"><?php the_title( '<h2 class="entry-title">', '</h2><!-- .entry-title -->' ); ?></a>
    
    			<div class="entry-content">
                    Categories: <?php $separator = ", "; the_category( $separator, $parents, $post_id ); ?>
                    <?php if ( has_post_thumbnail() ) { ?><a href="<?php echo get_post_meta($post->ID,'ct_Website_text_550e',true) ?>" rel="bookmark" target="_blank"><?php echo the_post_thumbnail('thumbnail', array('class' => 'alignright'));; ?></a><?php } the_content( __( 'Continue Reading' , 'nuntius' ) . ' &raquo;'); ?>
    				<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'nuntius' ), 'after' => '</p>' ) ); ?>
    			</div><!-- .entry-content -->
    		</div><!-- #post-## -->
    
    		<?php
    			// If comments are open or we have at least one comment, load up the comment template
    			if ( comments_open() || '0' != get_comments_number() )
    				comments_template();
    		?>
    
    		<?php endwhile; // end of the loop ?>

    Tim

    Thread Starter Tim W

    (@twalker123)

    Hi d4z,

    I don’t have any filters on the post content. If you look at the source, there are three anchors enclosing each other.

    Here is your code with my modifications:

    <?php
    /*
    Template Name: Clients
     */
    
    /* I use the action hook __after_loop
     * and partially replicate the customizr loop
     * to achieve:
     * 1) keep the page title
     * 2) show the page content if any, this can be used as a summary
     * before the list of posts
     */
    add_action('__after_loop', 'clients_list', 0);
    function clients_list(){
        add_filter('the_title', 'link_title_to_site', 0);
    
        global $wp_query;
        $wp_query = new WP_Query(array(
            /* change this with the query vars you need to display your cpts */
                'paged' => get_query_var('paged'),
                'post_type' => 'site'
            )
        );
        if ( have_posts() ) :
            while ( have_posts() ) :
                the_post();
                do_action ('__before_article');
                ?>
                    <article <?php tc__f('__article_selectors') ?>>
                        <?php do_action( '__loop' ); ?>
                    </article>
                <?php
                do_action ('__after_article'); 
    
            endwhile;
         endif; ##end if have posts
    }
    
    function site_link(){
        $href = get_post_meta($post->ID,'ct_Website_text_550e',true);
        return $href;
    }
    
    /* the title link */
    function link_title_to_site($title){
        /* your code to wrap the title into a link */
        return sprintf('<a href="%1$s" title="%2$s" target="_blank">%3$s</a>',
            site_link(),
            sprintf( __("Go to %s"), $title ),
            $title
        );
    }
    add_filter('tc_post_thumb_wrapper', 'change_thumbnails_link');
    function change_thumbnails_link($thumb){
        return preg_replace('/<a(.*?)href="(.*?)"(.*?)>/',
            '<a\1href="'.site_link().'"\3>',
            $thumb
        );
    }
    /*
     * in order to have the navigator we have to reset the custom query
     * with priority 30 (navigation has priority 20)
     */
    add_action('__after_loop', 'reset_query', 25);
    function reset_query(){
        global $wp_query, $wp_the_query;
        $wp_query = $wp_the_query;
    }
    
    /* let's remove customizr title filter on the title */
    remove_filter('the_title', array(TC_Headings::$instance, 'tc_content_heading_title'), 0);
    /* uncomment line below if you want to get rid of comments bubble */
    //remove_filter('the_title', array(TC_Headings::$instance, 'tc_add_comment_bubble_after_title'), 1);
    /* uncomment line below if you want to get rid of edit link */
    //remove_filter('the_title', array(TC_Headings::$instance, 'tc_add_edit_link_after_title'), 2);
    
    /*
     * let's include customizr index.php
     * this way we'll not lose eventual
     * changes on it
     */
    include_once( TC_BASE . 'index.php' );

    Here is the code I’m using to create the CPT:

    $nw_post_type = array(
              'labels' => array (
                'name' => 'Sites',
                'singular_name' => 'Site',
                'add_new_item' => 'Add New Site',
                'edit_item' => 'Edit Site',
                'new_item' => 'New Site',
                'view_item' => 'View Site',
                'search_items' => 'Search Sites',
                'not_found' => 'No sites found',
                'not_found_in_trash' => 'No sites found in trash',
              ),
              'taxonomies' => array('category'),
              'supports' =>
              array (
                'title' => 'title',
                'editor' => 'editor',
                'thumbnail' => 'thumbnail',
                'excerpt' => 'excerpt',
                'trackbacks' => 'trackbacks',
                'custom_fields' => 'custom-fields',
                'comments' => 'comments',
                'revisions' => 'revisions',
                'page_attributes' => 'page-attributes',
                'post_formats' => 'post-formats',
              ),
              'supports_reg_tax' =>
              array (
                'category' => '1',
                'post_tag' => '1',
              ),
              'capability_type' => 'post',
              'map_meta_cap' => true,
              'description' => 'NuggetWeb Websites',
              'menu_position' => 20,
              'public' => true,
              'hierarchical' => false,
              'has_archive' => true,
              'rewrite' =>
              array (
                'with_front' => true,
                'feeds' => false,
                'pages' => true,
                'ep_mask' => 0,
              ),
              'query_var' => true,
              'can_export' => true,
              'cf_columns' => NULL,
              );
        register_post_type( 'site', $nw_post_type );
    Thread Starter Tim W

    (@twalker123)

    Thanks d4z_c0nf!

    It is running the loop, but it looks like it’s still wrapping the title anchor in its own tag (twice?) and encoding the anchor string that’s being returned. The post titles are also being displayed twice, once with the featured image and once without…

    https://dev.nuggetweb.com/clients/

    Tim

    Thread Starter Tim W

    (@twalker123)

    Hi d4z_c0nf and nikeo – thanks for replying!

    d4z – I wrote my own plugin to add the CPTs I needed. The CPT plugins I found out there added more bloat than I felt like I wanted, so there’s no admin interface – just code to add the CPT the way I need it.

    What I’m doing is changing our current website from the current theme to Customizr Pro, and the only thing that doesn’t work the way I want it to is the CPTs.

    This is the one I’m starting with:

    Current website: https://nuggetweb.com/clients/
    Dev website: https://dev.nuggetweb.com/clients/

    What I want to do is really simple. I have a custom page template with the loop for the CPT, and I’m assigning the template to a page. What I need it to do is…
    1) replicate the Customizr loop so the style of the output is consistent from a blog page to the CPT list page.
    2) Change the links on the title and featured image to link to our client’s website – this is a CPT field.

    The problems I’m having are:
    1) I can’t find a loop in the Customizr code to replicate, so I’m using the code from our current website – the CSS is way wrong.
    2) Something in Customizr is overwriting the_title() so my titles don’t link to our client’s websites. The featured images link works as expected. See Giorgio and my last post for where we think it’s being overwritten.

    Any ideas on where to go from here would be really appreciated. I do really like the theme, BTW – so I don’t mean to be hard on anyone. It’s this one problem that I’m getting stuck on, and it probably wouldn’t effect all that many people.

    Tim

    Thread Starter Tim W

    (@twalker123)

    Keeping up is the hard part. Just when I think I’ve got it figured out somebody comes up with a “better” way to do something. ??

    I ended up looking at the same function in class-content-headings.php. The action filter is set at line 81 so I tried to unset the action filter, which seems like it should have worked, but didn’t…

    <?php remove_filter( ‘the_title’, ‘tc_add_comment_bubble_after_title’ ); ?>

    No worries Giorgio. I’ll be working on this hit-and-miss during the week, but I’m not sure how much time I’ll have to put into it until next week. I really appreciate your help!

    Tim

Viewing 15 replies - 1 through 15 (of 38 total)