Skip to content

Instantly share code, notes, and snippets.

View websitecareio's full-sized avatar
🏠
Working from home

Kim Vinberg websitecareio

🏠
Working from home
View GitHub Profile
/* For usage with acf_form() */
function my_acf_wysiwyg_character_counter() {
?>
<script type="text/javascript">
acf.add_filter('wysiwyg_tinymce_settings', function(mceInit) {
mceInit.elementpath = false;
mceInit.setup = function(ed) {
var characterLimit = 800,
edContainer,
@websitecareio
websitecareio / functions.php
Created November 9, 2021 22:09
Limit WordPress posts by author.
add_filter('pre_get_posts', 'posts_for_current_author');
function posts_for_current_author($query) {
if(!is_admin()) { return $query; }
global $pagenow;
if( 'upload.php' == $pagenow || !$query->is_admin ) {
if( !current_user_can( 'edit_others_posts' ) ) {
@websitecareio
websitecareio / acf_repeater_shortcode.php
Last active November 8, 2021 17:21 — forked from FranciscoG/acf_repeater_shortcode.php
An Advanced Custom Fields shortcode that allows to loop through a field with a repeater. This only handles simple cases, it can't handle nested repeater fields
/**
* ACF Pro repeater field shortcode
*
* I created this shortcode function because it didn't exist and it was being requested by others
* I originally posted it here: https://support.advancedcustomfields.com/forums/topic/repeater-field-shortcode/
*
* @attr {string} field - (Required) the name of the field that contains a repeater sub group
* @attr {string} sub_fields - (Required) a comma separated list of sub field names that are part of the field repeater group
* @attr {string} post_id - (Optional) Specific post ID where your value was entered. Defaults to current post ID (not required). This can also be options / taxonomies / users / etc
*/