Jay
Forum Replies Created
-
This is not currently possible with the default code. But can be extended to do so via other means. This however, is out of the scope of my support. Consider reading into GeoIP
Vincent – there should be a box in the options panel labeled Custom Css. Dropping that code there should do the trick.
No response in 3 weeks, so I’m assuming this is fixed.
Forum: Hacks
In reply to: form submission ajax woes on Ipad/AndroidYour code, even the ajax call itself has a very minimal footprint. I see no reason why the mobile browser would be shutting down?
One thing to think of, mainly because of when I submit an ajax form with I never use on-click, is you’re not stopping the default event.
Here’s a quick example gist: https://gist.github.com/46fccd3f5c3a1a1b0a38 – my javascript is abit different, but still similar.
Alternatively you might be able to just do something like this:
function test_submit( evt ) { evt.preventDefault(); // your stuff here }But again, I’ve never used on-click handlers in HTML, so excuse my ignorance.
Forum: Hacks
In reply to: Custom urlTake a look at WP_Rewrite – exactly what you’re looking for. The short of it, those are query args that you’re passing in the first URL. Using WP_Rewrite, you can convert the URL to a pretty permalink.
It’s not easy, or super straight forward ( ie. newbie friendly ) – but it’s exactly what you need.
Forum: Hacks
In reply to: How to make meta box checkbox work in wordpressMy first immediate thought is CMB2. Check out the file_list field type: https://github.com/WebDevStudios/CMB2/wiki/Field-Types#file_list
You’ll be able to upload multiple images to that field. Then on your front-end, just loop over the meta data.
For the lightbox, I’d check out some lightbox javascript plugins, like well LightBox, or even PrettyPhoto ( quite common)
You’ll have to read the documentation for your preferred JS library, but it’s definitely doable.
Forum: Hacks
In reply to: WP as homepage in other CMS directory@ernexus
You can certainly upload WordPress to a sub-directory. By default when extracted, WordPress comes out in a /wordpress directory. You can certainly name it whatever you want, /blog is quite common.Then just go to yoursite.com/blog/ and run the install. As for having your WordPress homepage as the homepage… that sounds a bit tricky. My first thought is an iframe, which shows the WordPress homepage.
I guess the question comes down to navigation, any link will automatically take you to the WordPress install in /wordpress ( or blog, whatever you name it ), I’m assuming your client already knows this?
Is the CMS proprietary? If it’s open source, chances are, someone’s created a bridge already. I know Joomla and Laravel ( NOT a CMS, but a framework ) has systems built to bridge the two, though I’ve not tried them.
Forum: Fixing WordPress
In reply to: Automatically being created a lot of spam users@diligent – Fact is, there are people that are paid real money ( USD or otherwise ) to create real accounts on your site for spamming purposes. Regardless of which system you use, if you allow public registration, spammers will be there.
Personally I use WangGuard and have taken the time to setup 20 questions ( suggest no less ). I’ve also set it up to run a cron job weekly, to flag spammers, you can also auto-delete flagged spammers if you wish.
As for comments, I NEVER open comments. Though my site isn’t super popular either! Though a site I manage gets about 10mil hits a month, and you can only imagine the comment queue, but they have an editorial staff to review and approve legitimate comments.
I have my comments set the same way, if the user has no approved comments, they can’t comment.
Unfortunately, all these actions aren’t nearly enough for the dedicated spammer. You could have a solid setup for spammers, but a normal human being like you or even me, can still register, and setup their script! When dealing with spammers, it comes down to diligence, and who will give up first.
One thing to look for, is if a spammer is using a specific IP to post from you will want to do your research, ie. is the IP an internet cafe? Is it consistent spam? Maybe consider banning that IP from your site!
Forum: Fixing WordPress
In reply to: 500 internal server error occuringIf there’s a 500 internal error, chances are it’s in your PHP error log, OR, if you have debug log enabled on your site, it may be there as well.
Every server is different, especially hosts, so your log may not be in the same place as mine – my log is at /var/log/httpd/error_log and can be read with notepad, or if you’re SSH savvy, just
tail -f error_logand watch when the error happens.If you’re on a managed or shared host, chances are you’ll have to contact them to get a copy of your log.
Alternatively, if you have access to your wp-config.php file ( you should! ) just enable debug there. With WP_DEBUG on, you’ll get a file located at wp-content/debug.log which you can read yourself.
Once you find the bug that’s causing the error, you’ll either A have to disable the plugin, or B, fix it yourself / or contact the dev.
If you need some debug snippets, or even some in-depth debugging tips, check this out: Debugging WordPress, Tips & Snippets
Forum: Hacks
In reply to: how to display a specific number of posts and repeat@Diggety
I’ve not used bootstrap in quite awhile, so please excuse my ignorance when it comes to tabulated functionality. Linked below is an example ( heavily notated ) which explains loops.
The example, however, is NOT final code, you’ll see it’s missing the UL tags and the recipe content section.
I’m not entirely sure what you’re trying to achieve. I’m assuming it’s a tabbed list of recipes. Whereas the recipes reside under category ID 6. But, instead of using category titles as tab titles, you’re using a post thumbnail from that category?
If that’s the case, you’ll want to use the offset code linked on the tab panel instead of the navigation.
Anyhow, here’s the link, hope you get something from it!
https://gist.github.com/38453e6e0d5703485a4dForum: Hacks
In reply to: How to make meta box checkbox work in wordpressYou can overwrite the WordPress gallery shortcode with your own output so you can keep the image select ability on the admin.
There’s tons of tutorials on the internet about overwriting the WordPress gallery output, i’m sure you’ll find one.
Forum: Hacks
In reply to: Custom Back ButtonSorry, probably should have included a usage example:
<?php $link = get_back_to_archive_link(); if ( ! empty( $link ) ) { echo "<a href='$link'>My Link Text</a>"; }If you read the comments, you’ll see that it will provide a link, only if a user is coming from a category or tag archive page.
So let’s say a user came from http://yoursite.com/category/term_name, the script would provide a link back to that page.
If, however, they came from http://yoursite.com/ ( ie. not an archive page ) no link will be given; which is why I use the empty check in the above code.
Forum: Hacks
In reply to: Custom Back ButtonFirst initial thought would be to use get_post_categories() – https://codex.wordpress.org/Function_Reference/wp_get_post_categories
However, then it can be said “what if you have multiple categories?”
So let’s say you have a category tree like this and ALL categories are assigned to that post.
|- Cat 1 |- Sub-Cat 1 |- Cat 2 |- Sub-Cat 2Sure you could do some magic to figure out which child category to use in your ‘Back To..’ link, but you’ll have to choose, and may send the user to the wrong sub-category archive.
If you want a true ‘Back to’ experience, use wp_get_referer() – https://codex.wordpress.org/Function_Reference/wp_get_referer
That way if they came from a sub-category page, wp_get_referer will provide the FULL url to that page. Short of it, I had some time, so here ya go: https://gist.github.com/JayWood/e7f2e83fb4d731abe7fa
I commented the heck outta the code so I hope it helps!
Happy Coding =^.^=
Forum: Hacks
In reply to: How to make meta box checkbox work in wordpress@kikib
The main problem was the inconsistency in the form parameters, and the fact you had no value set for the check-box. Also, you were using get_post_custom so you were getting array to string conversion errors.Simply put, make sure your input names match those $_POST names you’re handling in your form processing function. Below is a link to a diff from your original code to now, hope it helps!
https://gist.github.com/JayWood/d9891e4df302b6e45bb4/revisions
Also, if down the road, you need more than just a few meta-boxes, you might want to consider something like CMB2 for the ease of use: https://github.com/WebDevStudios/cmb2 | Or .org https://wordpress.org/plugins/cmb2/
Happy coding ^.^
Forum: Hacks
In reply to: Automatically create a post on user first loginWordPress does not store login attempts or times in the database. So here’s an idea, instead of trying to do it on their first login, why not just create the page if it doesn’t exist ON user login.
The idea is to check if the user already has a shop page, if not, then we check if the page already exists. If either of the two checks fail, we bail via
return;Otherwise, we can create a page, so we do, following the same arguments you provided. However, with an added addition. If the page creation is successful, we update the user’s meta data giving WordPress the newly created page ID so we can query it later if need be ( as seen in the top of the function ).
Here’s the gist https://gist.github.com/a902d60525e22b6f5add
If you want users to have the ability to create duplicate shops, you’ll have to do some magic with the
page_existschecks, but other than that, this should do what you’re looking for.