Show content from database

You could use custom post types and custom taxonomies. Using the custom post types to store data, taxonomies to categorize the data and you can utilize WordPress’ default searching functionality. https://codex.wordpress.org/Post_Types https://codex.wordpress.org/Taxonomies https://codex.wordpress.org/Creating_a_Search_Page

ACF: Only get first row of a Repeater Field

ACF has a function called get_row_index() that you can utilize. Here is how you can possibly use it in your case <?php $active=”active”; while ( have_rows(‘images’) ) : the_row(); $image = get_sub_field(‘image’); if(get_row_index() == ‘1’ ): ?> <img src=”<?php echo get_template_directory_uri(); ?>/files/images/<? php the_sub_field(‘image’); ?>” class=”img-fluid is-slider-item” /> break; <?php $active=””; endwhile; ?> <?php endif; … Read more

Register new user in the frontend

Yes, yes you can. The relevant functions to do this are: wp_create_user Creates a user given a user/pass/email wp_insert_user Creates or updates a user given user/pass/email add_user_meta Adds User Meta ( same as Post Meta/Custom fields but for users rather than posts ) You’ll find examples on how to use those functions, and links to … Read more

Help with AJAX front end comment moderation

Seems to me that the only problem is that you put the full approve url in the link, in this ways when you click the link you trigger the ajax and open the page url in the link. To be more clear your link is something like: <a class=”p3-comment-moderation” href=”https://wordpress.stackexchange.com/questions/128383/admin-ajax.php?action=p3_comment_approve&comment_id=123&nonce=xxxxx” data-comment_id=”123″ data-nonce=”xxxxx”>Approve</a> thanks to the … Read more

Disable or Enable Comments on Front end [closed]

Actually it’s there within WordPress by Default. If your WordPress editor is not showing it, then from the top left corner, click the Screen Options drop down menu. It’ll show some check boxes. Among those, there is one called Discussion. If you check that, then WordPress will show the option Allow Comments after the editor … Read more

Insert wp_editor on front-end with AJAX?

So, after doing some more digging, I answered my own question by “connecting the dots”, so to speak. There’s a lot of bits and pieces of info on this topic on StackOverflow and StackExchange, but none of them really answered my question. So here is the full working code to loading a wp_editor instance with … Read more

Frontend Post – Allow Only Image File Upload

You can check mime type of uploaded image before upload to media. Add mimeTypes in $allowmimeType which you want to allow. then check uploaded files mimetype $fileMimeType. If not found in allowed mimetype then return false. // Insert Attachment function insert_attachment($file_handler, $post_id, $setthumb=’false’) { if ($_FILES[$file_handler][‘error’] !== UPLOAD_ERR_OK){ return __return_false(); } # uploaded file type … Read more