Created
January 13, 2013 15:40
-
-
Save ockham/4524677 to your computer and use it in GitHub Desktop.
Patch to enable addition of an Edit post link to custom types as added by the Wordpress "My Content Management" plugin. (Tested with glossary terms.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u my-content-management/mcm-view-custom-posts.php my-content-management-edit-link/mcm-view-custom-posts.php | |
--- my-content-management/mcm-view-custom-posts.php 2012-10-27 20:27:18.000000000 +0200 | |
+++ my-content-management-edit-link/mcm-view-custom-posts.php 2013-01-13 16:14:14.000000000 +0100 | |
@@ -148,6 +148,7 @@ | |
$postclass = implode( ' ',get_post_class() ); | |
$p['postclass'] = $postclass; | |
$p['terms'] = ($taxonomy != 'all')?get_the_term_list( $id, $taxonomy,'',', ','' ):''; | |
+ $p['edit_link'] = get_edit_post_link($id) ? "<a href='".get_edit_post_link($id)."'>".__( 'Edit', 'my-content-management' )."</a>" : ""; | |
$custom_fields = get_post_custom(); | |
foreach ( $custom_fields as $key=>$value ) { | |
if ( is_array( $value ) ) { | |
@@ -461,4 +462,4 @@ | |
"<" . "/script><noscript>N/A" . | |
"<"."/noscript>"; | |
return $txt; | |
-} | |
\ Kein Zeilenumbruch am Dateiende. | |
+} | |
diff -u my-content-management/my-content-management.php my-content-management-edit-link/my-content-management.php | |
--- my-content-management/my-content-management.php 2012-10-27 20:27:18.000000000 +0200 | |
+++ my-content-management-edit-link/my-content-management.php 2013-01-13 16:04:45.000000000 +0100 | |
@@ -429,6 +429,9 @@ | |
<dt><code>{terms}</code></dt> | |
<dd><?php _e('List of taxonomy terms associated with post.','my-content-management'); ?></dd> | |
+<dt><code>{edit_link}</code></dt> | |
+<dd><?php _e('When logged in, display link to edit the current post.','my-content-management'); ?></dd> | |
+ | |
</dl> | |
<p> | |
<?php _e('Any custom field can also be referenced via shortcode, using the same pattern with the name of the custom field: <code>{custom_field_name}</code>','my-content-management'); ?> | |
@@ -861,4 +864,4 @@ | |
add_action( 'wp_footer','mcm_add_js' ); | |
add_action( 'wp_head','mcm_add_styles' ); | |
-add_filter('plugin_action_links', 'mcm_plugin_action', -10, 2); | |
\ Kein Zeilenumbruch am Dateiende. | |
+add_filter('plugin_action_links', 'mcm_plugin_action', -10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment