scribu
Forum Replies Created
-
Forum: Plugins
In reply to: [Front-end Editor] How to add a full edit link?Yeah, I’ve heard that one before: “We’ll really sit down and learn WordPress, just after we finish this client project. Can you help? (It will be the last time; we promise.)”
Good luck.
Forum: Plugins
In reply to: [Front-end Editor] How to add a full edit link?I would be simply amazed if you could help make it come true…
Learn JavaScript; it’s not that hard, especially now with so many free online courses.
Forum: Plugins
In reply to: [Front-end Editor] How to add a full edit link?You’re trying to embed PHP directly into a JavaScript file. It won’t work, because the JavaScript file doesn’t have accees to any PHP functions defined in WordPress, such as
edit_post_link().You can either:
a) generate the full edit button in your theme (hidden) and then re-position it via JS.
b) send an AJAX request with the post ID, get back the edit link and insert it into the DOM via JS.
Forum: Plugins
In reply to: [Posts 2 Posts] is it possible to add connection metabox in frontend?Anything is possible, if you want it bad enough. 🙂
Translation: it requires a lot of work.
Forum: Plugins
In reply to: [Posts 2 Posts] Issue grabbing post connected to future postWhat SQL errors?
Forum: Plugins
In reply to: [Posts 2 Posts] count connections not workingYou’re accepting
$post_idas a function parameter, but you pass$post->IDto WP_Query.Forum: Plugins
In reply to: [Posts 2 Posts] count connections not workingThat’s a really old snippet. Connection types have names.
What should work now:
$connected = new WP_Query( array( 'connected_type' => 'YOUR_CONNECTION_TYPE_NAME', 'connected_items' => $post->ID, ) ); echo $connected->found_posts;Note that
$connectedcontains a (limited) list of posts too, not just their count.Forum: Plugins
In reply to: [Posts 2 Posts] Is it possible to show post thumbnail in admin box?It’s tricky to do right now, but it’s a good idea. I’ll consider implementing it for the next version.
Forum: Plugins
In reply to: [Posts 2 Posts] Is it possible to show post thumbnail in admin box?Do you mean in the connections table or in the post list below?
Forum: Plugins
In reply to: [Razor] Usage Documentation?And I doubt the WP database class wraps queries in a transaction, either.
The WPDB class doesn’t, but the test runner does:
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { function setUp() { ... global $wpdb; $wpdb->query( 'SET autocommit = 0;' ); $wpdb->query( 'START TRANSACTION;' ); ... } function tearDown() { global $wpdb; $wpdb->query( 'ROLLBACK' ); ... } ...http://unit-test.svn.ww.wp.xz.cn/trunk/includes/testcase.php
PS: Thanks for the answers so far.
Forum: Plugins
In reply to: [Razor] Usage Documentation?WordPress plugins really, really need to adopt unit testing, and we want to make that happen.
Then write some ****ing documentation for WP Razor! It might be brilliant, but people simply won’t invest hours in it, just to figure out if it makes sense to use it, or if they should use the official unit testing suite or what.
And no, saying “just look at the code” doesn’t cut it. There are a few basic, high-level things that are critical to getting started, which aren’t easy to gleam by looking at the code.
For example:
* Do I always need the
testplan.phpfile?* Does WP Razor automatically wrap DB queries in a transaction, like the official unit tests do, or do I have to manually clean up the database?
* How does QUnit fit into all of this?
These are just off the top of my head.
I’ve tried to use WP Razor several times, and each time I just gave up, because it seemed too much of a headache to set up. So, I just invented my own system, based on the official testing suite, because it has a basic guide and it doesn’t try to wrap around PHPUnit, so you can just look at PHPUnit’s documentation for details.
In conclusion, if you really want other people to adopt WP Razor, you have to put up some docs/tutorials/comparisons to get them started.
Forum: Reviews
In reply to: [WP-UserOnline] problemas no foncionamento@alchymyth: Reviews automatically show up in the support forums.
Correction: They show up in http://ww.wp.xz.cn/support/view/plugin-committer/scribu
Forum: Plugins
In reply to: [Posts 2 Posts] Show in admin UI only childrenYou can alter the query used by the metabox using the ‘p2p_connectable_args’ filter:
https://github.com/scribu/wp-posts-to-posts/wiki/Admin-box-filters
Forum: Plugins
In reply to: [Posts 2 Posts] Show in admin UI only childrenWhy not make two separate post types: ‘company’ and ’employee’
Added ‘admin_box_candidates’: https://github.com/scribu/wp-posts-to-posts/commit/dc576d5ea05c6b6397d6985fbec561c5ee5b73fc