Mike Rodriguez
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Store Locator] Can I pass the zip code using url parameters?+1 on the ability to search automatically after the zipcode is populated via query string.
Any input on how this can be achieved? @tijmensmit
Forum: Plugins
In reply to: [Custom Post Type UI] Huge Icon after update+1
Forum: Fixing WordPress
In reply to: global $post not working! Trying to get the post IDOddly enough, I did post it in the plugins topic, but it was deleted.
I was able to figure it all out. Thanks for your help, guided me in the right direction.Forum: Fixing WordPress
In reply to: global $post not working! Trying to get the post IDUPDATE!!!!!!!
I had to go into the plugin files and edit some files. I had to pass the global $post and create a parameter for the after_quiz_done() function.
The post id is successfully getting passed through. Th only thing im getting is a php error that says
Warning: Missing argument 5 for after_quiz_done() in C:\Program Files (x86)\wamp\www\wp-acf-test\wp-content\themes\twentythirteen\functions.php on line 563
Anyone have some knowledge on this error?
Forum: Fixing WordPress
In reply to: global $post not working! Trying to get the post IDI also just noticed that this plugin creates it’s own database tables. Could that be the issue on why it cannot retrieve the post id?
Forum: Fixing WordPress
In reply to: global $post not working! Trying to get the post IDUPDATE:
After experimenting a bit, I tried one last ditch effort and was able to return only the ID of the first quiz in the post type lesson. Not sure if this is on the right track or just a complete fail.
add_action('ssquiz_finished', 'after_quiz_done', 10, 4); function after_quiz_done( $quiz_id, $user_id, $questions_right, $total_questions ) { $args = array('post_type'=> 'lesson'); query_posts( $args ); while ( have_posts() ) { the_post(); $theID = get_the_ID(); }; echo $theID; }
For the love of WordPress and web dev, can anyone shed some light on this? I desperately need help! Thanks so much.
Forum: Fixing WordPress
In reply to: global $post not working! Trying to get the post IDI’ve been at this issue for HOURS now. I need some help or a push in the right direction at least, because I’m stumped.
Issue: I need to get the post ID inside functions.php
I’m using a plugin called SS Quiz. This plugin is a quiz making plugin, in which you make a quiz on the backend and display it using shortcodes inside your WP WYSIWYG editot. Simple, just like lots of plugins out there.
SS Quiz has a hook in which once the quiz is submitted, it will excute a block of code. Below is the exact code and documentation:
add_action('ssquiz_finished', 'after_quiz_done', 10, 4); function after_quiz_done( $quiz_id, $user_id, $questions_right, $total_questions ) { // do stuff here }
hook is triggered when SSQuiz is finished by the user
What i’m trying to do is get the post id of the current post/page in which the quiz is on, and execute a block of code simply returns the post id. I’ve tried everything from using the global $post to setting up postdata(setup_postdata()) inside the function. Nothing has worked. I can return thing like current logged in user, but simply not the post id.
Can anyone test this on their end and see how they can get the post ID? Whether it be on a live server or locally. I just need a push in the right direction at this point.
ANY help would be greatly appreciated!
Forum: Fixing WordPress
In reply to: global $post not working! Trying to get the post IDIt’s really hard to tell where my debugging should begin.
The code runs after you submit your quiz form. On the main plugin file, the file with the do_action code is included after everything else.
I’m proficient in wordpress and php but this one has really stumped me.
Forum: Fixing WordPress
In reply to: global $post not working! Trying to get the post IDThe do_action() is being called from a plugin file. (Plugin is called SS QUIZ)
Here is the code:
$output = ob_get_contents(); ob_end_clean(); $finish_screen .= $output; $temp = new stdClass(); $temp->user_name = $info->user->name; $temp->user_email = $info->user->email; $temp->time_spent = time() - $info->started; $wpdb->insert("{$wpdb->base_prefix}ssquiz_history", array( 'user_id' => $info->user->id, 'quiz_id' => $info->quiz->id, 'meta' => serialize( $temp ), 'answered'=> $info->questions_counter, 'correct' => $info->questions_right, 'total' => $info->total_questions ), array( '%d', '%d', '%s', '%d', '%d', '%d' ) ); if( $info->questions_counter == $info->total_questions ) { // API $percent = intval(strval($info->questions_right / $info->questions_counter * 100 ) ); //$info->questions_counter !=1 do_action( 'ssquiz_finished', $info->quiz->id, $info->user->id, $info->questions_right, $info->total_questions );
Forum: Fixing WordPress
In reply to: How to build a recipe "template" for users to contribute their own?Advanced Custom Fields + Custom Post Types can do the job. ACF supports front end forms now, so you can easily allow users to submitted or contribute by allowing them to post specified to the custom post type you created.
first, locate where exactly you want to put them on your template.
second, add the <?php the_field(‘your-field-name’) ?> code to the that section.
afterwards your list should appear on your posts.
The documentation on the plugin website is very clear on the code you need to add to your template.
https://www.advancedcustomfields.com/docs/getting-started/If you’re looking for form submission, I’d suggest you try another plugin like gravity forms.
The ACF plugin is made to add custom fields to your wordpress edit screen. If you want those fields to show up on the front end of your site, follow the link below on the tutorial for front end forms.
https://www.advancedcustomfields.com/docs/tutorials/creating-a-front-end-form/Forum: Fixing WordPress
In reply to: Javascript code apprearing on index.php – Malware Issue?I’m very aware, but I need to know WHERE this is coming from. It happened to me a few months ago with an eval(base_64 php script and i was able to recover, now its a javascript hack.
Thank You.
Forum: Plugins
In reply to: WP eCommerce – IF on category pageanyone?
bump