Forum Replies Created

Viewing 13 replies - 16 through 28 (of 28 total)
  • Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Thanks Szymon,
    Using options would solve most of the potential issues of method 1. In fact if we add the options page as a sub menu to the custom post type in the dashboard it’s even friendlier for clients than using a page.
    I’ve also found a couple of posts detailing how to add custom post type archive to menus in the dashboard.
    Once I’m done with the research and have a decent method for both I may wrap it up as a plugin and adding it to the repository.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    I thought I’d come back and update this post in case its useful to anyone else. The problem was that I had changed the name of the wp-content folder for security reasons the plugin has the wp-content folder hardcoded in.

    To fix the plugin I changed:

    /plugins/ui-for-wp-simple-paypal-shopping-cart/wordpress-simple-paypal-shopping-cart-ui.php

    on line 70

    from
    $this->plugin_url = $site_url . '/wp-content/plugins/' . $this->plugin_dir_name . '/';
    To
    $this->plugin_url = $site_url . '/NewContentDirName/plugins/' . $this->plugin_dir_name . '/';

    Neil

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    I have this working as I wanted now, for future reference I will share the code I used which I adapted from Russ’ answer here. Add this to your single-cpt.php file in your template theme, or create one if you don’t already have one.

    <?
    $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'CPT' ORDER BY menu_order", 'OBJECT');
    
    if ( $child_pages ) :
        foreach ( $child_pages as $pageChild ) :
            setup_postdata( $pageChild );
            $thumbnail = get_the_post_thumbnail($pageChild->ID, 'thumbnail');
            if($thumbnail == "") continue; // Skip pages without a thumbnail
    ?>
            <div class="child-thumb">
              <a href="<?= get_permalink($pageChild->ID) ?>" rel="bookmark" title="<?= $pageChild->post_title ?>">
                <?= $pageChild->post_title ?><br /><?= $thumbnail ?>
              </a>
            </div>
    <?
        endforeach;
    endif;
    ?>

    Replace where it says post_type = ‘CPT’ with your own custom post type name and if you want to make an image slider like I did change the div child-thumb to match the layout required by the slideshow or carousel you are using.

    In order for this solution to work you must set Hierarchial to true and supports must include page-attributes within the CPT settings in your functions.php file ie:
    'hierarchical' => true 'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),

    You will also want to set your post type to be ordered by menu order by adding this to your functions.php file

    //Order custom post type by menu order (must have supports page-attribute)
    function CPT_archive_order( $vars ) {
      if ( !is_admin() && isset($vars['post_type']) && post_type_supports($vars['post_type'], 'page-attributes') ) {
        $vars['orderby'] = 'menu_order';
        $vars['order'] = 'ASC';
      }
    
      return $vars;
    }
    add_filter( 'request', 'CPT_archive_order');

    I hope that helps some else in the future.

    Spacechimp out

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Ahh I see what I did. The correct code for those who are also wondering about this is:

    // Remove white label cms options for users who can't update core
    function remove_wlcms() {
        if( !current_user_can( 'update_core' ) ):
      remove_submenu_page('options-general.php','wlcms-plugin.php' ); 
    
     endif;
    }
    add_action( 'admin_menu', 'remove_wlcms' );
    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Yea that seems to be the way I’m headed. Looking at the existing CPT UI plugins on the WP Plugin directory yields some interesting results. I think I need something simpler than most here but it’s a great jump off point.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Ahh I understand. In that case I will rethink my plugin. I’ll have to make the plugin create the CPT based on user preferences on a settings page rather than renaming the labels after creation. I’m sure I can figure that out …. probably.

    Thanks again for helping me

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Thanks Mika for once again supplying an answer to one of my posts. In the meantime I did a little research of my own and of course you are dead right.
    I should point out this plugin, for the sake of anyone who finds this post in search of similar answers Custom post type editor. It allows you to edit the labels of a CPT but as Mika explains the URL slug cannot be changed.

    I must admit I’m not sure why this is. Couldn’t we add a function based on this line:
    ‘rewrite’ => array( ‘slug’ => ‘New_name’ ),
    when creating a CPT?

    In order to achieve what I’m after I am attempting to develop my own plugin which creates both the custom post type and a widget to display it on the home page. The widget allows me to set a number of the CPT titles to display within the widget options. I’ve managed this so far without a hitch. My next plan is to add a text field in the widget(?) which will change the CPT labels and slug. Using this method I hope to still be able to create theme templates with the CPT’s original name IE single-original_name.php and archive-original_name.php

    I assume from what both you (Mika) an the Custom post type editor plugin developer have said that this last step will cause me problems?

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    @ipstenu Yeah I realise that hence the reason I asked :p

    As a follow up question – With Paypal add to cart buttons is there a major difference between the website form and the Email link?

    Couldn’t I just get away with using the Email link and some fancy CSS to add these buttons and avoid the form all together? or would that in some way negate security. I assume there must be a problem or Paypal would provide this themselves right?

    EDIT:
    Ah just reaslised the button wouldn’t allow for product options which would require a drop down form IE colour or Size…

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Yea I think I will build shortcodes and insert buttons for tinyMCE. It was only really an idea because a lot of my clients have asked for the functionality and explaining shortcodes proves difficult to some of the less technically minded ones, especially when the companies (paypal and google docs) own websites provide instructions obviously not involving shortcodes. My ultimate goal, and I’m sure most designers are the same, is to keep things as simple as possible for my end user.

    Thank you both for your input.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Since it seems there is no real answer to this I have implemented a slightly different solution. I don’t rely on the custom background any more but have added a background option in my own theme options.

    @MayConect and anyone looking to implement a similiar solution Devin Price’s options framework is an excellent place to start.

    Hi Sean,

    I’m never certain when to use Multisite myself in honesty but I normally end up asking do I NEED multisite? you have to ask yourself the same question. Would be easier or better to just use Categories and perhaps Custom Post Types.
    If you use CPT you could change the logo text at the top of the templates files for those pages. It might mean it’s slightly easier to maintain.

    Using Multisite means you have one whole admin area for each sub site which can be a hassle if you don’t really need it. You can still attach your other domain names to a non networked site as parked domains which may be all you need.

    Whenever possible make things easy on yourself, life will find it’s own complications to throw your way :D.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    *solved*

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Ah it seems that the plugin is connected to ‘manage_options’ which allows user roles to see see and edit Settings in the dashboard. I’ve changed this to false which hides both the settings and Security from my new user role. – Job done.

Viewing 13 replies - 16 through 28 (of 28 total)