monkeybrain
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: List posts for each taxonomy/tag of a custom post typeThanks a lot! This looks like it could work, unfortunately when I simply copy and paste it, it returns a blank page. With an unexpected <? in the line of
<?php // create our link now that the post is setup ?>… so I tried to fix the syntax but somehow don’t get it right. (I’m more of a CSS guy and don’t understand PHP very well)I added ?> to this line
while ( $the_query->have_posts() ) { ?>and tried to useendwhile; endif;before thewp_reset_postdata();
Unfortunately I then get a syntax errorunexpected 'endwhile' (T_ENDWHILE)Would it be possible to get some help with the syntax details?
Thanks Jan,
Yes, I figured as much. It probably is just a small detail somewhere in these 100 lines of code. But being more of a front-end guy I can’t find the error.
Maybe someone else can have a look at it. Or maybe someone can tell me how much work it would be to fix it, I guess I could pay for an hour or so.
As far as I see it checks the theme version, pings the API and if there is a newer version it updates the theme. And I have no idea how any of that could break the plugins functionality.
Thankful for any suggestions.
<?php /**/ // TEMP: Enable update check on every request. Normally you don't need this! This is for testing only! //set_site_transient('update_themes', null); // NOTE: All variables and functions will need to be prefixed properly to allow multiple plugins to be updated /******************Change this*******************/ $api_url = 'https://api.url.goes.here'; /************************************************/ /*******************Child Theme****************** //Use this section to provide updates for a child theme //If using on child theme be sure to prefix all functions properly to avoid //function exists errors if(function_exists('wp_get_theme')){ $theme_data = wp_get_theme(get_option('stylesheet')); $theme_version = $theme_data->Version; } else { $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css'); $theme_version = $theme_data['Version']; } $theme_base = get_option('stylesheet'); **************************************************/ /***********************Parent Theme**************/ if(function_exists('wp_get_theme')){ $theme_data = wp_get_theme(get_option('template')); $theme_version = $theme_data->Version; } else { $theme_data = get_theme_data( TEMPLATEPATH . '/style.css'); $theme_version = $theme_data['Version']; } $theme_base = get_option('template'); /**************************************************/ //Uncomment below to find the theme slug that will need to be setup on the api server //var_dump($theme_base); add_filter('pre_set_site_transient_update_themes', 'check_for_update'); function check_for_update($checked_data) { global $wp_version, $theme_version, $theme_base, $api_url; $request = array( 'slug' => $theme_base, 'version' => $theme_version ); // Start checking for an update $send_for_check = array( 'body' => array( 'action' => 'theme_update', 'request' => serialize($request), 'api-key' => md5(get_bloginfo('url')) ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url') ); $raw_response = wp_remote_post($api_url, $send_for_check); if (!is_wp_error($raw_response) && ($raw_response['response']['code'] == 200)) $response = unserialize($raw_response['body']); // Feed the update data into WP updater if (!empty($response)) $checked_data->response[$theme_base] = $response; return $checked_data; } // Take over the Theme info screen on WP multisite add_filter('themes_api', 'my_theme_api_call', 10, 3); function my_theme_api_call($def, $action, $args) { global $theme_base, $api_url, $theme_version, $api_url; if ($args->slug != $theme_base) return false; // Get the current version $args->version = $theme_version; $request_string = prepare_request($action, $args); $request = wp_remote_post($api_url, $request_string); if (is_wp_error($request)) { $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message()); } else { $res = unserialize($request['body']); if ($res === false) $res = new WP_Error('themes_api_failed', __('An unknown error occurred'), $request['body']); } return $res; } if (is_admin()) $current = get_transient('update_themes'); ?>Forum: Plugins
In reply to: [Frontend Uploader] Required CheckboxThanks a lot!
For now I just used a sentence that says “By submitting this form you accept our terms” but it would be great if this could be fixed in a future version.
Cheers!
Forum: Hacks
In reply to: This function stopped working with 3.6Thanks a lot, bcworkz!
Using excerpt_more works! (No issues with other theme filters)