Tag Info

Hot answers tagged

57

You can do that by copy your theme's page.php to a new file named something like user-profile.php and add to the very top of it this code: <?php /** * Template Name: User Profile * * Allow users to update their profiles from Frontend. * */ /* Get user info. */ global $current_user, $wp_roles; get_currentuserinfo(); /* Load the registration file. ...


17

Brady is correct that the best way to handle saving and displaying of custom post type orders is by using the menu_order property Here's the jquery to make the list sortable and to pass the data via ajax to wordpress: jQuery(document).ready(function($) { var itemList = $('#sortable'); itemList.sortable({ update: function(event, ui) ...


16

Uploading files in ajax is a bit tricky because it is not possible to upload files using the browser's XMLHttpRequest object so you need to use some kind of Ajax upload plugin and the easiest one would be the the JQuery Form Plugin which makes things much easier and it's included in WordPress. So to use it you need to enqueue it: ...


14

If you are talking about the answer i posted here its simply uploading file in an iframe to achieve "Ajax like" submit. Now if you already have a form that handles the post submit you can simply add the upload file field input somewhere in your form: <form ... ... <input type="file" name="thumbnail" id="thumbnail"> ... ... </form> make ...


10

<?php $postTitle = $_POST['post_title']; $post = $_POST['post']; $submit = $_POST['submit']; if(isset($submit)){ global $user_ID; $new_post = array( 'post_title' => $postTitle, 'post_content' => $post, 'post_status' => 'publish', 'post_date' => date('Y-m-d H:i:s'), 'post_author' => ...


9

You do cite experience with WP going back farther than that of mine... Yet I do not see these issues as that major. What scale of sites are we talking about? It's fairly slow I feel this is bit too much of generalization. Slow can be put in context of specific hardware, tasks and level of traffic. It's blanket statement otherwise. It's often overly ...


9

Its Not has hard as you think it is :) Add the password fields to your form : password: <input type="password" name="pass1" style="width:250px; margin-bottom:3px;"><br /> repeat password: <input type="password" name="pass2" style="width:250px; margin-bottom:3px;"><br /> then in your if($_POST){ replace this line: ...


8

I use Advanced Custom Fields for lots of front end post editing with meta boxes. ACF allows you to build lots of advanced meta box fields and adds them automatically to the back end post panel. But there is a front end function as well. This method is completely free. The only way it costs anything is if you want to use any of their more complex field type ...


7

There are a few functions that come in handy here: unstick_post - Unstick a post stick_post - Stick a post is_sticky - Figure out if a post is sticky With those three in mind, all we need to do is stick them together with some admin menu bar glue. First off, let's wrap everything in a class for fun and profit. This class will have some constants that ...


7

Well, Thanks to wp 3.3 now we have wp_editor() function to do that :)


6

Yes it's possible. You have to create three filters for this. Admin stuff inside a class class WPSE29338_Admin { public static function setup() { add_filter('login_url', array(__CLASS__, 'modifyLoginURL'), 10, 2); add_filter('lostpassword_url', array(__CLASS__, 'modifyLostPasswordURL'), 10, 2); add_filter('register', ...


6

Jeff Starr wrote a great tutorial on front-end registration, login and password recovery taking the similar approach as suggested by onetrickpony. So take this as a follow up to his answer and as another resource that might help you get it done: http://digwp.com/2010/12/login-register-password-code/ Now you have two examples how to code this yourself and ...


6

I actually wrote this for Happy Tables so should be able to give you a couple of pointers, though I don't have time to go into too much depth at the moment. We use this "image well" on tables tables a fair bit, it's basically the drag/drop upload from the WordPress upload. Similar to something like this: ...


5

I wanted to provide you with a few ideas but once I started I couldn't stop myself and wrote this little plugin with an obscure name to get you started. <?php /* Plugin Name: WPSE Crowded Cats Plugin URI: http://wordpress.stackexchange.com/questions/43419/how-do-i-create-a-way-for-users-to-assign-categories-to-a-post-from-the-frontend Description: Allow ...


5

The WP User Frontend plugin will meet all your needs. You can find the plugin here: https://wordpress.org/extend/plugins/wp-user-frontend/. The plugin gives ability to the user to create new post, edit post, edit profile from site frontend. So users doesn't need to enter the admin panel. Everything they need to do can be done from the frontend. If you do a ...


5

There is no such action in the front end (in a theme) by default. Simply use a custom action like do_action( 'theme_notices' ); and hook into this one.


5

The WordPress function get_the_modified_author() will give you the author who last edited the current post. But if you want to list all the users that have edit the current post, you could try: function get_the_modified_authors_wpse_99226(){ global $wpdb; $authors = array(); $results = $wpdb->get_results( $wpdb->prepare("SELECT ...


5

It is really not best practice to do it this way at all. In fact you don't need to create an ajax.php file unless you're just going to include it in your functions.php file. You need to read up on AJAX in WordPress. You would just add an action on 'wp_ajax_name_of_action' and just specify the action within the javascript ajax function. Simple example ...


5

Here is a basic solutions for updating a post/page. I added a quick demo of custom meta fields. This is pretty basic, but will point you in the direction of plugin-less editing of posts on the front-end. This isn't super flexible, but you can add whatever you need to it. Add this code into your loop: <form id="post" class="post-edit front-end-form" ...


5

There's a global variable called $wp_scripts which is an instance of the WP_Scripts class. It doesn't have a public API for looking at registered or enqueued scripts, but you can look inside the object and see what's going on. You can see all the registered scripts with: global $wp_scripts; var_dump( $wp_scripts->registered ); To see the enqueued ...


5

A simple user meta row can handle that for you (the second issue), you can store the post id and the vote (up/down) in an array and that is just the same as post meta ex /** * update user vote per post * @param int $user_id * @param int $post_id * @param mixed $vote can be an integer 1 / -1 and can also be a string "up"/"down" * @return void */ ...


5

I just ran into this issue as well, the cause of this is that at 600 pixels wide the admin bar goes from being position:fixed to position:absolute; When fixed, it is locked to the top of the screen (top:0) When absolute it is locked to the top of the closest container that contains it. This is the html element by default, but if a parent is defined to have ...


4

Use esc_url( $url ) for URLs that should be displayed and esc_url_raw( $url ) if the URL should be sent to the database. The first will replace bare ampersands & with &#038;. The second is a wrapper for the first; it will just suppress the escaping of ampersands. Both functions will check the protocol. See wp_allowed_protocols() for the list: ...


4

Never ever use your theme/plugin files directly for ajax calls, always use admin-ajax.php. This is the only recommended way of doing ajax to ensure maximum compatibility with wordpress (including future versions) & 3rd party plugins/themes The best/easiest way depends on the situation & is debatable but i would ask you to use admin-ajax.php even if ...


4

Sorry about that feels a bit weird answering ones own question, but here you go.... Firstly declare the variable: (customcategory) global $userdata; $errors = array(); $title = trim($_POST['wpuf_post_title']); $customcategory = trim($_POST['customcategory']); $content = trim($_POST['wpuf_post_content']); $tags = ...


4

First create a function that will print the publish button : //function to print publish button function show_publish_button(){ Global $post; //only print fi admin if (current_user_can('manage_options')){ echo '<form name="front_end_publish" method="POST" action=""> <input type="hidden" name="pid" id="pid" ...


4

@AboSami actually answered this question in an older post that was not showing up in my search diligence. While he was actually looking for something else his example code worked great. Here's the script: <?php $post_id = $post->ID; if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) { require_once(ABSPATH . ...


4

You want to include wp-load.php at the beginning of your script/page like this : require_once("/path/to/wordpress/wp-load.php"); You then have access to any WP functions. To manipulate the DB directly, have a look at wpdb.


4

if I post today, it lists it as April 30th, 2013 (today is April 6th, 2013). Your using a lowercase t in your date format string. t Number of days in the given month 28 through 31 On Line 92: echo get_the_time('M-t-y \a\t g:ha' , $id); I think you meant to use d or j instead.


4

From your comment above, I believe you're running into issues with the _wpnonce piece of the puzzle. Looking at the code in /wp-admin/post.php, it appears that the untrash instruction is checking for a valid WordPress nonce, and not getting one. This might do the trick: <?php function wpse_95348_undelete_post( $post_id ) { // no post? if( ...



Only top voted, non community-wiki answers of a minimum length are eligible