Jay
Forum Replies Created
-
Forum: Hacks
In reply to: Git Libraries in wordpressGit itself is just a version control system, not really an interpreter. It’s basically a hard drive for storage ( to simplify it A LOT ).
By ‘add git hub libraries in WordPress’ I assume you found something need on Git that you want to use. You need to simply download it on GitHub, and move it where you want it to be ( the big green download button ).
Chances are you’ve probably not used
gitcommand line yet – if that’s the case, I suggest you start here: https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-RepositoryForum: Hacks
In reply to: Assigning individul post Id's to menu itemsThe key is here
echo '<li class="'. $class .'">' . $term->slug . '</li>';This is what we call PHP concatenation. You can see more info on it here: http://php.net/manual/en/language.operators.string.php
Basically the code is just echoing a string. So, if you want to add a class to each
lielement, you need only do the following:echo '<li class="someAmazingClassHere '. $class .'">' . $term->slug . '</li>';Notice I left a space after the class, that’s because your
currentclass will be appended inside there based on the PHP var.Forum: Hacks
In reply to: Problem with ading customfields within functions.phpThe best place to start is with adding a metabox. You can see the developer documentation here: https://developer.wordpress.org/reference/functions/add_meta_box/
Once you’re comfortable with that, or if you need something more simplistic, check this out: https://wordpress.org/plugins/cmb2/
Basically you need a metabox to actually accept the data, or your ‘customized values’. Once you have that, then, and only then should you be using save-post hook to update the meta data.
Forum: Hacks
In reply to: Sidebar showing at bottom of pageHey Jess,
It would appear to be a column count issue. The theme you’re using looks to be a grid-based theme and two of the blocks are both
sixteen columnsin width. Followed by yourright-sidebarwhich isfive columns.So to be clear, you have two 16 column wide modules, one ‘no column module’ the
Alumni Directory, and finally your sidebar, which is 5 columns.This is a template issue, not really a plugin issue.
Forum: Hacks
In reply to: Multiple Filter Too Slow@burhansalt – Meta and Term queries are inherently slow. As your database grows, they will only slow down more.
Your query looks okay, so if I were you I would at minimum, cache the query results based on the arguments, either using Transients, or the Object Cache to prevent slamming your server every request.
Forum: Hacks
In reply to: code file inclusion question.Typically when working with things such as API’s it’s great to use things like
function_exists()andclass_exists()checks to allow future dev’s to overwrite these at a later date.This allows future developers to overwrite the file entirely, thus, upgrading the API or downgrading in some cases.
With that being said, though I’ve never used this, you could look into
override_function()andrename_function()http://stackoverflow.com/questions/15230883/how-to-override-built-in-php-functions
Simple solution – never modify core!!!
But in all honesty, you can report the bad plugin and someone will review it. https://wordpress.org/support/topic/reporting-bad-plugins?replies=7
Or if you’re on slack, just ask there. I’m not entirely sure it’s a ‘bad’ plugin, but it is definitely a user education issue, as Jan said.
With that being said though, consider writing a legitimate review for the plugin here: https://wordpress.org/support/view/plugin-reviews/hook-sniffer#postform
Too many times people forget that ratings actually impact a plugin’s performance, and we as devs learn from our mistakes. I’m not saying to flame the guy, but write an honest review about why this was a bad experience for you. It helps us devs so much!
Forum: Hacks
In reply to: How to get Values from FrontEnd User Form and display in WP Admin Panel?@aleykey – That
unsubscribe()function is part of a hook. Look into how AJAX works with WordPress here: https://codex.wordpress.org/AJAX_in_PluginsThere has to be an action similar to
add_action( 'wp_ajax_{ajax_action}', array( $this, 'unsubscribe' ) );unless it wasn’t inside of a class then the last parameter wouldn’t be an array.So to the point of @bcworkz – once you have the
wp_ajax_{ajax_action}name, you can simply make your own, as well as your own function, and handle the data like you want to. You won’t have to edit the plugin’s file in any way.Forum: Hacks
In reply to: wp_list_pages remove link to draft pagesYour answer is in your code.
<?php wp_list_pages( array( 'title_li' => '', 'child_of' => '4721', 'post_status' => 'publish' // remove draft ) );Forum: Plugins
In reply to: [WooMinecraft-WP] Tried to add pex command but it doesn't workYep, it’s a quotes thing. I’ve opened a ticket here: https://github.com/WooMinecraft/woominecraft-wp/issues/16 and will track code/updates there.
I should have some time tomorrow to work on that since I’m making changes to WMC anyhow.
Forum: Plugins
In reply to: [Agy - Age verification for WooCommerce] Show content warning in category?Please do not post NSFW links on the forum. I have a link for that http://plugish.com/contact-me/
And no, it doesn’t look like it’s even activated. What theme are you using?
Forum: Plugins
In reply to: [WooMinecraft-WP] Tried to add pex command but it doesn't workThe second would work for you. The first, well I know it’s not going to work because we escape the quotes ( maybe removes them ) before inserting into the database.
I completely forgot pex used double quotes in commands. I’ll see about testing and fixing that hopefully sometime this week.
Forum: Hacks
In reply to: Assign different taxonomy term to custom post type based on field valueFor the hook, I would recommend a cron-task. That way it’s ran once every say 15 minutes. A good place to start with crons is wp_schedule_event() https://codex.wordpress.org/Function_Reference/wp_schedule_event
The problem you’re going to have is the way you’re storing the dates
mm/dd/yyyywhile yes, it’s more readable for us Americans ( it’s how we do it ), it’s hard to compare the data directly in WP QueryYou should update how you’re saving the meta data and force it to save in ISO-8601 format ( Y-m-d ) – though ultimately I always save date/timestamps as Unix format.
Otherwise, yes you’re forced to loop over every single post, then check the date via get_post_meta, and you would have to remove the meta_key and meta_value_num keys from the query I gave you.
Forum: Plugins
In reply to: [WooMinecraft-WP] Tried to add pex command but it doesn't workCan you explain what you mean by ‘doesnt work with pex command’?
Pasting the command here will help, since I can test it with Pex and see what’s going wrong.
Forum: Plugins
In reply to: [Agy - Age verification for WooCommerce] Video Magazine ThemeThere’s a filter for that, you can support multiple post types simply by dropping this code into your theme, or it’s own plugin if you wish.
<?php function add_video_posts( $post_types ) { $post_types[] = "video_posts"; // Change this to the post type slug return $post_types; } add_filter( 'cwv3_post_types', 'add_video_posts' );https://github.com/JayWood/content-warning-v3/wiki/Dev-Documentation#support-multiple-post-types