尝试破解 wordpress jetpack php 以允许公开已发布的帖子
Trying to hack the wordpress jetpack php to allow publicizing of already published posts
我在我的博客上发布了一个 post,但在传输过程中出了点问题,post 没有被推送到电子邮件、facebook、linkedin 等。但是现在 post 是已发布,我无法返回并勾选允许我 post 到 Facebook 的复选框。为了允许我切换复选框,我需要在以下代码中破解什么?
private function get_metabox_form_connected( $connections_data ) {
global $post;
$all_done = $this->publicize->post_is_done_sharing();
$all_connections_done = true;
ob_start();
?>
<div id="publicize-form" class="hide-if-js">
<ul>
<?php
foreach ( $connections_data as $connection_data ) {
$all_connections_done = $all_connections_done && $connection_data['done'];
?>
<li>
<label for="wpas-submit-<?php echo esc_attr( $connection_data['unique_id'] ); ?>">
<input
type="checkbox"
name="wpas[submit][<?php echo esc_attr( $connection_data['unique_id'] ); ?>]"
id="wpas-submit-<?php echo esc_attr( $connection_data['unique_id'] ); ?>"
class="wpas-submit-<?php echo esc_attr( $connection_data['service_name'] ); ?>"
value="1"
<?php
checked( true, $connection_data['enabled'] );
disabled( false, $connection_data['toggleable'] );
?>
/>
<?php if ( $connection_data['enabled'] && ! $connection_data['toggleable'] ) : // Need to submit a value to force a global connection to POST ?>
<input
type="hidden"
name="wpas[submit][<?php echo esc_attr( $connection_data['unique_id'] ); ?>]"
value="1"
/>
<?php endif; ?>
<?php echo esc_html( $this->connection_label( $connection_data['service_label'], $connection_data['display_name'] ) ); ?>
</label>
</li>
<?php
}
$title = get_post_meta( $post->ID, $this->publicize->POST_MESS, true );
if ( ! $title ) {
$title = '';
}
$all_done = $all_done || $all_connections_done;
?>
</ul>
<label for="wpas-title"><?php _e( 'Custom Message:', 'jetpack' ); ?></label>
<span id="wpas-title-counter" class="alignright hide-if-no-js">0</span>
<textarea name="wpas_title" id="wpas-title"<?php disabled( $all_done ); ?>><?php echo esc_textarea( $title ); ?></textarea>
<a href="#" class="hide-if-no-js button" id="publicize-form-hide"><?php esc_html_e( 'OK', 'jetpack' ); ?></a>
<input type="hidden" name="wpas[0]" value="1" />
</div>
<?php if ( ! $all_done ) : ?>
<div id="pub-connection-tests"></div>
<?php endif; ?>
<?php // #publicize-form
return ob_get_clean();
}
https://www.ryadel.com/en/wordpress-re-enable-publicize-already-published-posts-via-jetpack-publicize/ 建议破解 UI 模板 - 但每次更新插件时都会被覆盖。
https://cfxdesign.com/how-to-re-publicize-posts-with-jetpack/ 有另一种方法 - 它添加了删除 Jetpack 用来确定 post 已经发布的 post 元数据的功能。
(通过高级或专业计划,Jetpack 显然也提供了该功能。)
我在我的博客上发布了一个 post,但在传输过程中出了点问题,post 没有被推送到电子邮件、facebook、linkedin 等。但是现在 post 是已发布,我无法返回并勾选允许我 post 到 Facebook 的复选框。为了允许我切换复选框,我需要在以下代码中破解什么?
private function get_metabox_form_connected( $connections_data ) {
global $post;
$all_done = $this->publicize->post_is_done_sharing();
$all_connections_done = true;
ob_start();
?>
<div id="publicize-form" class="hide-if-js">
<ul>
<?php
foreach ( $connections_data as $connection_data ) {
$all_connections_done = $all_connections_done && $connection_data['done'];
?>
<li>
<label for="wpas-submit-<?php echo esc_attr( $connection_data['unique_id'] ); ?>">
<input
type="checkbox"
name="wpas[submit][<?php echo esc_attr( $connection_data['unique_id'] ); ?>]"
id="wpas-submit-<?php echo esc_attr( $connection_data['unique_id'] ); ?>"
class="wpas-submit-<?php echo esc_attr( $connection_data['service_name'] ); ?>"
value="1"
<?php
checked( true, $connection_data['enabled'] );
disabled( false, $connection_data['toggleable'] );
?>
/>
<?php if ( $connection_data['enabled'] && ! $connection_data['toggleable'] ) : // Need to submit a value to force a global connection to POST ?>
<input
type="hidden"
name="wpas[submit][<?php echo esc_attr( $connection_data['unique_id'] ); ?>]"
value="1"
/>
<?php endif; ?>
<?php echo esc_html( $this->connection_label( $connection_data['service_label'], $connection_data['display_name'] ) ); ?>
</label>
</li>
<?php
}
$title = get_post_meta( $post->ID, $this->publicize->POST_MESS, true );
if ( ! $title ) {
$title = '';
}
$all_done = $all_done || $all_connections_done;
?>
</ul>
<label for="wpas-title"><?php _e( 'Custom Message:', 'jetpack' ); ?></label>
<span id="wpas-title-counter" class="alignright hide-if-no-js">0</span>
<textarea name="wpas_title" id="wpas-title"<?php disabled( $all_done ); ?>><?php echo esc_textarea( $title ); ?></textarea>
<a href="#" class="hide-if-no-js button" id="publicize-form-hide"><?php esc_html_e( 'OK', 'jetpack' ); ?></a>
<input type="hidden" name="wpas[0]" value="1" />
</div>
<?php if ( ! $all_done ) : ?>
<div id="pub-connection-tests"></div>
<?php endif; ?>
<?php // #publicize-form
return ob_get_clean();
}
https://www.ryadel.com/en/wordpress-re-enable-publicize-already-published-posts-via-jetpack-publicize/ 建议破解 UI 模板 - 但每次更新插件时都会被覆盖。
https://cfxdesign.com/how-to-re-publicize-posts-with-jetpack/ 有另一种方法 - 它添加了删除 Jetpack 用来确定 post 已经发布的 post 元数据的功能。
(通过高级或专业计划,Jetpack 显然也提供了该功能。)