Viewing 11 to 14 of 14 items
Archive | Code Snippets RSS feed for this section

Modifying queries with pre_get_posts

Written by Remi Corson. you can for example query only posts from a specific type and with a custom meta field key equal to a determined value. In the code below, we are targeting only custom post type called “portfolio” where meta key “project_type” is set to “design”, that’s a typical query that can be  Full Article…

0

Remove a category from the front-page.php

The correct way to do this is to make use of pre_get_posts which change the query vars just before the main query is executed. Here is an example from the codex to exclude categories from the home page/blog page. For a full list of available parameters and values that you can use with pre_get_posts, visit  Full Article…

0

Gravity forms access for clients

Taken from Gist: https://gist.github.com/mannieschumpert/7188426 When using Gravity Forms on a client project, you might want the client to be able to view and manipulate form entries, without giving them administrator access. The user_has_cap filter allows us to add capabilities without changing the role in the database. This gist allows users with the editor role to  Full Article…

0

Change the Gravity Forms submit button

Taken from Gist here: https://gist.github.com/mannieschumpert/8334811 Filter the submit button in Gravity Forms to change the <input type=”submit> element to a <button> element. There’s an example in the Gravity Forms documentation, but it lacks the proper code to show your custom button text, AND removes important attributes like the onclick that prevents multiple clicks. I was  Full Article…

0