macardam
Forum Replies Created
-
Forum: Plugins
In reply to: [A Random Number] Random number generatorYou’re probably receiving the error because you’re pasting the code into the Visual tab of the text editor instead of the Text tab. Also, the replies here may be adding formatted quotations. It should look like this:
How many grams are there in a <span class="n01">[arandomnumber min=1 max=10000]</span> pound sample? The answer is [calculate]<span class="n01a"></span>*454[/calculate]
Unfortunately, the [calculate] shortcode won’t work with this solution. If I can find some time, I can try to update the plug-in to allow for reusing numbers, but at this point I’m not sure there is anything else I can suggest. This plug-in was created to be very simple and output a random number each time it was called, so it’s probably not the best option for more complex solutions like this.
Forum: Plugins
In reply to: [A Random Number] Random number generatorHowever, I’m not sure if this will work with the [calculate] shortcode. What plug-in are you using for that?
Forum: Plugins
In reply to: [A Random Number] Random number generatorI recommend adding a plug-in such as https://www.ads-software.com/plugins/head-footer-code/ that can allow you to easily add js code to your site.
After activated, you can then add the following to the FOOTER Code option:
<script> jQuery(document).ready(function() { jQuery( ".n01" ).clone().appendTo( ".n01a" ); jQuery( ".n02" ).clone().appendTo( ".n02a" ); }); </script>
You can change n01/n01a, and n02/n02a to whatever you prefer, or add more lines here as needed.
Then, following your example above, you can use:
—
How many grams are there in a <span class=”n01″>[arandomnumber min=1 max=10000]</span> pound sample?The answer is [calculate]<span class=”n01a”></span>*454[/calculate]
—Let me know if that works for you.
Thanks!
Forum: Plugins
In reply to: [A Random Number] Random number generatorHi,
Unfortunately, this isn’t possible with the plug-in. By default, the shortcode outputs a random number each time it’s called. This would require updating the plug-in to set an identifier so a number can be reused again. I like the idea, but I don’t currently have the time to update it.
One idea I can think of off the top of my head would be the wrap the shortcode in a span tag, then use jQuery to grab the number that is generated, and paste it between a different span tag. I did a quick test and the below worked for me.
HTML
Here is my first random number: <span class=”n01″>[arandomnumber min=1 max=10000]</span>
Here is my second random number: <span class=”n02″>[arandomnumber min=1 max=100]</span>Here is the first number again: <span class=”n01a”></span>
Here is the second number again: <span class=”n02a”></span>JS
jQuery(document).ready(function() { jQuery( ".n01" ).clone().appendTo( ".n01a" ); jQuery( ".n02" ).clone().appendTo( ".n02a" ); });
Class names can be changed to anything else, and you can add as many as you like. The JS code needs to be placed in a custom.js file or wrapped in a script tag and placed in a field for custom code, if your theme has one.
This will always take the value of whatever is within the n01 span tag and append it to the n01a span tag. Each time the page reloads the numbers will change, but n01 will always match n01a, etc.
I hope this is helpful!
Forum: Plugins
In reply to: [Health Check & Troubleshooting] fatal error when activating troubleshootGreat! Will try when the update is released and let you know if it works.
Forum: Plugins
In reply to: [Health Check & Troubleshooting] fatal error when activating troubleshootJust to give an update here – This error does seem related to child themes. I changed my site so the parent theme was active, instead of the child theme, and the plug-in worked fine.
Forum: Plugins
In reply to: [Health Check & Troubleshooting] fatal error when activating troubleshootWe’re using a premium theme so have to pay for the theme: https://www.wpbeaverbuilder.com/wordpress-framework-theme/
I think Beaver one of the most widely used builders and theme.
Forum: Plugins
In reply to: [Health Check & Troubleshooting] fatal error when activating troubleshootSo essentially, the plug-in is unusable for my setup at this time?
Forum: Plugins
In reply to: [A Random Number] Does this plugin use a lot of memory?Hello,
No, this should not use a lot of memory. Have you tried disabling this or other plug-ins one at a time to see if any resolve the crashing issue?
Forum: Plugins
In reply to: [Eventbrite API] assign discount code on load?I’m editing a template to show some instructions and only the ticket form, which is the eventbrite_ticket_form_widget() function.
Possible to pass a discount code into this function to have it apply by default?
Nothin’?
For example:
2016-08-16: Remove category “New”
2016-08-30: Remove category “Featured”
2016-09-02: Remove category “On Sale”etc.
Right now I can only set one at a time.
Forum: Plugins
In reply to: [PHP Code for posts] update broke pagesWell, figured it out. For some reason after updating the plugin it was deactivated yet still showing as activated under the Plugin list? Very odd… When I clicked on “PHP Code” on the left sidebar in the dashboard, I received a permission error and then the plugin was shown as deactivated. I activated the plugin again and now all those snippets are working again.
So, that was weird.
Forum: Plugins
In reply to: [A Random Number] Template tag?If you’re using it anywhere in the WP editor, just use the shortcode
[arandomnumber]
If you’re using it in templates or anywhere you have to call it via php, use the code:
<?php echo do_shortcode('[arandomnumber]'); ?>
Forum: Plugins
In reply to: [A Random Number] Template tag?I’m not exactly sure what you’re asking. The plugin uses a shortcode only and can be used in any post, page, widget, or template.
Full documentation: https://www.macardam.com/a-random-number/