rmsgreig
Forum Replies Created
-
thanks for your help, finally cracked it :-), i was a long the right lines before but not quite there so your example really helped me to figure out the structure.
Forum: Developing with WordPress
In reply to: How to call shortcodes in buttons in shortcode?I have it working! Thank you so much for your help 🙂 — I was missing the <form> </form> and then it was a case of making sure each button has a unique name which I did by adding the ID to the name and using a variable in the isset.
- This reply was modified 9 years ago by rmsgreig.
Forum: Developing with WordPress
In reply to: How to call shortcodes in buttons in shortcode?It looks like it is the if isset($_post[*] that is causing the issues, i took one of the shortcodes out and it displays fine – any ideas how I would fix this/get around it?
Forum: Developing with WordPress
In reply to: How to call shortcodes in buttons in shortcode?Hi I have pasted my code to here: https://pastebin.com/YsG9U84c
I have a debug plugin set up in the wordpress site but it’s not showing anything when I try and use the buttons?Forum: Developing with WordPress
In reply to: How to call shortcodes in buttons in shortcode?yes this is from my outer shortcode handler function, I have updated the code but still nothing seems to be happening, could it be the input buttons themselves? Can’t figure out how I could set up a debug to figure out why it’s not working here is my extended code:
- This reply was modified 9 years ago by rmsgreig.
- This reply was modified 9 years ago by Jan Dembowski.
Forum: Developing with WordPress
In reply to: How to call shortcodes in buttons in shortcode?Could you give me an example of how I would do this do you mean add the shortcodes to my $return or have different returns for each button?
My first shortcode is in the template file and my other shortcodes are in the functions file – should these all be in the same place?
Sorry if this sounds confusing, I’m relatively knew to wordpress – so very much learning on the job.
Thanks for your helpForum: Developing with WordPress
In reply to: How to call shortcodes in buttons in shortcode?thanks, it doesn’t seem to be working though am I missing something?
Ahh great I now have the templates appearing :-). Still no luck with the parent dropdown – I was hoping to be able to select a different custom post type as the parent am I going about this wrong? for example I will have a competition and the fixtures would be a children of a competition?
thanks
Forum: Developing with WordPress
In reply to: Populate custom post from external apiJust in case anyone else comes across my post while looking for help, it turns out it was a problem with the way the ssl was set up on the server, if you have the same issue add ‘sslverify’ => false in the remote get array and this should solve the issue.
Forum: Developing with WordPress
In reply to: json_decode expects paremter 1 to be string array givenI get a response when I make a manual request to the browser it just doesnt seem to come through to wordpress. Is there anything else I could do to check this within wordpress? I am talking to the api developer as well to try and figure something out but as I dont have that much wordpress experience I am worried that it is my error
ThanksForum: Developing with WordPress
In reply to: json_decode expects paremter 1 to be string array giventhanks for your help, I still seem to be returning no data when I call the api though 🙁 really don’t know what I am doing wrong…
<?php /** * Plugin Name: this plugin * Plugin URI: * Description: * Version: 1.0.0 * Author: * Author URI: * License: GPL2 */ // import seasons and competitions function import_seasons() { $season_request = 'https://thisdomain.co.uk/api/season'; $username = 'thisdomain'; $password = 'thisdomain/user'; $headers = array( 'Authorization' => 'Basic ' . base64_encode( "$username:$password" ) ); $season_response = wp_remote_get( $season_request, array( 'headers' => $headers)); if ( is_wp_error( $season_response ) ) { $error_string = $season_response->get_error_message(); echo '<div id="message" class="error"><p>' . $error_string . '</p></div>'; } if( is_array($season_response ) ) { $season_header = $season_response['headers']; // array of http header lines $season_body = json_decode( $season_response['body'] ); // use the content $season_data = $season_body; } else{ $season_data = wp_remote_retrieve_body($season_response); } } function insert_or_update($season_data) { if ( ! $season_data) return false; $args = array( 'meta_query' => array( array( 'key' => 'season_id', 'value' => $season_data->id ) ), 'post_type' => 'seasons', 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit'), 'posts_per_page' => 1 ); $season = get_posts( $args ); $season_id = ''; if ( $season ) $season_id = $season[0]->ID; $season_post = array( 'ID' => $season_id, 'post_title' => $season_data->startDate, 'post_content' => $season_data_data->competition, 'post_type' => 'seasons', 'post_status' => ( $season ) ? $season[0]->post_status : 'publish' ); $season_id = wp_insert_post( $season_post ); if ( $season_id ) { update_post_meta( $season_id, 'season_id', $season_data->id ); update_post_meta( $season_id, 'json', addslashes( file_get_contents( 'php://input' ) ) ); } print_r( $season_id ); } add_action('init', 'import_seasons'); add_action('init', 'insert_or_update'); ?>- This reply was modified 9 years, 2 months ago by rmsgreig.
Forum: Developing with WordPress
In reply to: Populate custom post from external apithanks for the advice, I will give it a try and let you know how I get on