fireproofsocks
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Content Type Manager] Possible Issue with WP 3.8 & CCTMI’m not an expert on .htaccess modifications either, unfortunately, but in theory yes you could make alterations there. It would be muddying up the setup, so I’m bristling at the thought of it. Ugly links would cause much cleaner execution here, but I know few people prioritize functionality over aesthetics. The only other thing I can say to try is changing your permalink settings, saving them, and then changing them back: this can cause the rules to be regenerated and in some cases, the posts will be “visible” to WP’s radar after the rules are regenerated.
I’m working on the new version of this that fixes this, and offers new flexibility for URLs.
Forum: Plugins
In reply to: [Custom Content Type Manager] how to filter on datefieldIt’s tough if the dates aren’t stored in a sortable format. The only way to really fix that is to go through each field and convert the date. In lieu of having a script that will do that, you’d have to edit the field definition so it uses a valid format, and then re-edit and re-save each post using that field. Painful, I know.
Forum: Plugins
In reply to: make a dropdown list from the [summarize-post]That’s a bit beyond the scope of what I can advise you with, unfortunately. It’s probably an uphill battle trying to wrestle anything in the_conent() into something specific since WP filters it in several places already and there’s no guarantee what shape the value will be in by the time it gets to you. WP also has the bad habit of PRINTING output instead of RETURNING it, making it quite difficult to do any further modifications with it. If you need the content in a list, the best way to do it is to create the content as a list when you create/edit the post/page.
I get flamed all the time by saying stuff like this, but if you want to learn PHP, I would recommend that you do not look to WP as a model of how to code. It may get your feet wet, but its architecture is often structured on some very bad patterns that are best avoided by the serious developer.
Forum: Plugins
In reply to: make a dropdown list from the [summarize-post]Glad it worked. I guess it depends on what you need to do with the option — summarize posts isn’t really intended as a form-generation tool, so I’m not sure it helps you once you need to do something with the form you’ve created. There is the cctm_post_form shortcode used to generate a post-generation form: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/cctm_post_form — it would allow users to submit their own posts.
Forum: Plugins
In reply to: [Custom Content Type Manager] MultiLangThat’s a complex question. The CCTM doesn’t necessarily help or hurt you do that. There are other plugins that would let you enter translated content into a single field. Another option is to create different fields to contain different translations.
Forum: Plugins
In reply to: make a dropdown list from the [summarize-post]The shortcode formatting is customizable. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/summarize_posts_shortcode
For example:
<select> [summarize_posts]<option value="[+ID+]">[+post_title+]</option>[/summarize_posts] </select>Note that you will have much more freedom here if you use the PHP equivalent to the shortcode.
Forum: Plugins
In reply to: [Custom Content Type Manager] Custom Content Type Manager add mediaThanks — let me know so I can test against it.
The “if(empty(…))” construct is very common in PHP, so it’s good to get used to it. It sounds like you might be running into some of the inanities of the quirky query_posts() function.
Maybe you can wrap that call in its own if statement:
<?php $variablename = get_post_meta($post->ID, "custom-field-id", true); if (!empty($variablename)) { query_posts('name=' .$variablename); } else { print 'Sorry, there are no results.'; }Relation fields store an id to the referenced post or page (or image). From there, the question I always get is “what do I with that number?” It’s a common need to look up the data from that related post (e.g. https://code.google.com/p/wordpress-custom-content-type-manager/wiki/FAQ#My_Image/Relation/Media_Field_Only_Shows_Numbers._WTF?!?). Specifically relevant to this is the get_post filter: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_post_OutputFilter (which is just a wrapper around the GetPostsQuery class — see also https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_post_complete for a simpler interface).
You’re basically trying to do the same thing I think, but you’re referencing the post by name instead of by ID, and that’s much more fragile. The post ID will never change, whereas the name might, and that could break your site. I’m glad if you got something working there, I would rethink it a bit if it were me.
E.g. if you have a relation field storing a reference to a parent page, and then you want the current page to list all the children of that referenced page, in your template could do something like this:
$referenced_page_id = get_custom_field('my_related_page'); // relation field returns ID $args = array(); $args['post_parent'] = $referenced_page_id; $Q = new GetPostsQuery(); $results = $Q->get_posts($args); foreach ($results as $r): ?> <h2><?php print $r['post_title']; ?></h2> <p><?php print $r['post_content']; ?></p> ...etc... <?php endforeach;That example assumes you’ve structured your pages hierarchically so we can query using the “post_parent” field, but hopefully you can see the principle there.
Re empty values: good. There’s also the “default” output filter for that (https://code.google.com/p/wordpress-custom-content-type-manager/wiki/default_OutputFilter) but it wouldn’t apply unless you were using the get_custom_field function.
Yes, you could do that, but it seems awkward — as you noticed, the ‘get_custom_field’ function needs to be called when a post is in context, otherwise it doesn’t know which post to pull the custom fields from.
I’m not sure if I follow what you’re trying to do, but perhaps you could leverage this a bit more cleanly if you use the “Relation” custom fields (https://code.google.com/p/wordpress-custom-content-type-manager/wiki/Relation) ?
Re query_posts, I got so sick of its syntax and caveats that I abandoned its use entirely and created my own db querying class for use in the CCTM (see GetPostsQuery https://code.google.com/p/wordpress-custom-content-type-manager/wiki/GetPostsQuery), but querying is only part of your problem here I think.
You could create a series of pages (regular pages or some custom post type either way) and add a summarize_posts shortcode on them (see https://code.google.com/p/wordpress-custom-content-type-manager/wiki/summarize_posts_shortcode). Or you could add the GetPostsQuery PHP equivalent to corresponding the template file. You wouldn’t be defining the search results by post name per se (although you could), you would be defining it by modifying the query present in the shortcode.
Hope something up there helps.
Forum: Plugins
In reply to: [Custom Content Type Manager] Custom Content Type Manager add mediaHow are you going about it? It should work, but this deals with a part of WP code that is seriously messy, so there have been frequent breakdowns especially after WP updates. What version of the plugin and what version of WP?
Forum: Plugins
In reply to: [Custom Content Type Manager] how to filter on datefieldYou can use the debug method:
// ... $results = $Q->get_posts($args); print $Q->debug();That will give you the raw queries and you can run them on your MySQL instance. That’s the best way to test this — it’s forces you to check the values in your fields too.
Forum: Plugins
In reply to: [Custom Content Type Manager] Possible Issue with WP 3.8 & CCTMThanks for the info — yeah, I think the problem is how and when the plugin rewrite rules are flushed. In 0.9.7.6, the rewrite rules were flushed more often.
Another workaround that may work: change permalink settings globally, then change them back. In some tests, that has successfully regenerated permalink rules for the defined custom post types.
I’m working hard on the next version with a lot of improvements for this and testability overall.
Forum: Plugins
In reply to: [Custom Content Type Manager] Password Field?I should add that this offers no security: the value will still be stored in the database as plain text and in your templates, you can still print the value exactly as entered by using the “:raw” output filter. So this “solution” is just for aesthetics. Anyone with access to the manager and a little bit of patience would be able to bypass the “****” mask and see the password.
Forum: Plugins
In reply to: [Custom Content Type Manager] Password Field?You can do this as a text field with a custom template. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/CustomizingManagerHTML
Say for example your custom field is named “password”. Copy the
wp-content/plugins/custom-content-type-manager/tpls/fields/elements/_text.tplintowp-content/uploads/cctm/tpls/fields/elements/password.tpl(the name must match the field name). In your copy, just change the field type from “text” to “password”:<input type="password" name="[+name_prefix+][+name+]" class="cctm_text [+class+]" id="[+id_prefix+][+id+]" value="[+value+]" [+extra+]/>Finally, you would need to flush the CCTM’s cache so it loads your custom template to draw those fields. Just go to the CCTM –> Clear Cache menu and you should be set.