fireproofsocks
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Content Type Manager] Exclude a category from queryThere’s not a great way to do this, unfortunately: categories are stored in separate tables, so the more filters available on related tables, the less efficient the query becomes.
You can use the built in WP functions if they offer a better interface for that particular type of query.
Forum: Plugins
In reply to: [Custom Content Type Manager] to array randomYes, but that’s a php question. See the rand function http://www.php.net/manual/en/function.rand.php and the count function.
E.g.
$size = count($my_array); $random_spot = rand(0, $size-1); print $my_array[$random_spot];Forum: Plugins
In reply to: [Custom Content Type Manager] Delete 'Content Type' Entry & Start Fresh?Wow, that’s a lot of words — are you trying to use the summarize_posts shortcode? If so, you can specify an “order” and “orderby” parameter to affect the sorting. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts#orderby
As for database interactions, I’m not clear what you’re trying to do. The plugin tries to be as laissez faire as possible: posts and fields are not deleted from the database unless you specifically enable this behavior in the global config.
I think you’re running into the behaviors of the Numeric validator, and yes, as you noticed, hyphenated values are not considered numeric, so they get truncated. Turn off the numeric validator for that field if you need to use values like that or add your own custom validator.
Forum: Plugins
In reply to: [Custom Content Type Manager] sticky postI’m not sure of the built-in mechanics of a sticky post, but I know how I would do it if I had to do it from scratch:
I’d add a custom checkbox field named “is_sticky” or some such and check the posts I wanted to stick. Then in the template file, I would use 2 queries/loops: the first to retrieve posts with is_sticky=1, the 2nd (normal) to retrieve posts where is_sticky=0.
Forum: Plugins
In reply to: [PHP Snippets] Passing ArgumentsAh… well, if you’re just passing a value to the snippet, just set it as an argument in your shortcode:
[lesson_plan x="123"]The variables used correspond to the variables available in your snippet:
print $x; // prints 123WP has caveats as to the names of the variables (e.g. keep them all lowercase).
Some examples are on the wiki: https://code.google.com/p/wordpress-php-snippets/
Other than that, the only way to “pass” values to your snippets would be via globals or super-globals (e.g. url parameters passed in the $_GET array). How you react to that variable depends on your code I suppose … e.g. including a file depending on the value passed, etc.
Hope that clarifies.
Forum: Plugins
In reply to: [PHP Snippets] Passing ArgumentsUsing WP from the command line is not well supported — I’ve looked into it for a number of projects and although it’s possible, the degree of skill it requires and the insane workarounds required to actually pull it off are not for the faint of heart – WP just was not built with that in mind and you can’t retroactively fix architectural shortcomings.
PHP Snippets can pass arguments TO the command line if your code uses exec(), system(), passthru() etc, just make sure you escape the command and its arguments thoroughly (http://www.php.net/manual/en/function.escapeshellcmd.php and http://www.php.net/manual/en/function.escapeshellarg.php).
However passing arguments FROM the command line to a PHP Snippet here would definitely be flying off the radar — PHP Snippets is designed to support one thing only: WP shortcodes, and shortcodes exist entirely as a by-product of having a simplified GUI manager. If you’re needing to do a lot of command-line stuff, I would recommend a framework like Laravel and against WP entirely. Hope that helps.
Forum: Plugins
In reply to: [Custom Content Type Manager] Custom Content Type Manager add mediaI guess I’m gonna close this — fire up a bug report if this comes up again.
Forum: Plugins
In reply to: [Custom Content Type Manager] Repeated fields tableThanks for clarifying. It sounds like you could define 2 post-types: assets and portfolios. You need a repeatable relation custom field attached to the portfolio where you can select 1 or more assets for that field. In the manager, it’s not a table (by default), it’s just a sortable list, but on the front-end you can format it like a table.
You can customize the manager HTML to make it look like a table, but that’s just aesthetic — but you can customize the templates used so that the manager interface looks the way you want and displays the custom fields you want for each selection. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/CustomizingManagerHTML
Would that work?
Forum: Plugins
In reply to: [Custom Content Type Manager] Repeated fields tableIf you mean that you want asset A to have custom fields B,C,D and asset B to have custom fields E,F,G, then the answer is no: that defeats much of the purpose of the plugin. The goal is to normalize data definitions, i.e. standardize the custom fields so that a given data type (e.g. “asset” or “property” or “portfolio”) always has the same number and type of fields. You run into trouble when one instance of a record has one set of fields and another instance of a record has a different set of fields. Although I can see some reasons for doing this (there is a feature request for this already I believe), operating a site like that does cause a lot of problems when it comes to maintenance and reporting.
The best workaround I could recommend would be to add a single “Notes” field and add your various notes there. Hope that helps.
Forum: Plugins
In reply to: [Custom Content Type Manager] Trying to import a json fileThe CCTM supports saving / downloading / uploading of JSON files that it uses to store its definitions — it’s a very specific format for a very specific purpose. Virtually *anything* can be saved as a JSON file, so it sounds like you’re trying to fit a round peg into a square hole. That’s like calling the Gettysburg address and the source code for Linux the same thing because they are both saved as a .txt file.
Forum: Plugins
In reply to: [Custom Content Type Manager] MultiLangI don’t know if they’d work together or not — best to try it and find out. Technical services can be provided via the author URL, but the moderators frown upon discussing anything like that in the forums.
Forum: Plugins
In reply to: [Custom Content Type Manager] how to filter on datefieldYes. Look at the values in the wp_postmeta table. A sortable format would be something like a Unix timestamp (e.g. 12345678) or a MySQL datestamp (e.g. 2014-04-21)
Forum: Plugins
In reply to: [Custom Content Type Manager] cctm_post_form define categoryForum: Plugins
In reply to: [Custom Content Type Manager] cctm_post_form define categoryNo, that’s not currently supported — it would make a nice feature request though.