w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Post redirect to 404 page from admin side in wordpress
Now that you did the fix, you probably need to login using a different browser. Redirects are cached for a while. If your new browser works, clear the cache in your main browser and try again.

Categories : Wordpress

Wordpress custom post type capabilities, admin can't edit post type
thats a strange problem. it should work. the following will work for you (note i just copied paste my code so some of my code creeped in) add_action('init', 'register_custom_event_type'); function register_custom_event_type() { register_post_type('event', array( 'labels' => array( 'name' => _x('Event', 'Event'), 'singular_name' => _x('Event Custom Post', 'domain'), 'add_new' => _x('Add New', 'domain'), 'add_new_item' => _x('Add New Event Custom Post', 'domain'), 'edit' => _x('Edit', 'domain'), 'edit_item' => _x('Edit Event Custom Post', 'domain'), 'new_item' => _x('New Event Custom Post', 'domain'), 'view' => _x('View Event Custom Post', 'domain'), 'view_item' => _x('View Event Custom Post', 'dom

Categories : Wordpress

Varnish with wordpress breaks the wordpress visual editor?
Yes it was happening whether logged in or not. The issue was with the call to devicedetect in the vcl_recv. I created a new vcl_recv after the first to handle the devicedetect routine. This somehow fixed the problem. Thanks

Categories : Wordpress

Missing HTML Head section from admin system->configuration->Design in magento
If you have added new layout in your cms section . And added Mage/Page module config.xml in local, then also add system xml there.I thing this will work for you. local/Mage/Page/etc/system.xml

Categories : Magento

category filter to admin product grid with distinct records (using group breaks pagination)
If you are facing group by issue.I solve the same problem multiple time using this way . Copy Db.php file from magento / lib / Varien / Data / Collection / Db.php Paste it to your local directory so the resultant folder structure would look like this: magento / app / code / local / Varien / Data / Collection / Db.php. Now open this file to edit and replace getSelectCountSql function with below one public function getSelectCountSql() { $this->_renderFilters(); $countSelect = clone $this->getSelect(); $countSelect->reset(Zend_Db_Select::ORDER); $countSelect->reset(Zend_Db_Select::LIMIT_COUNT); $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET); $countSelect->reset(Zend_Db_Select::COLUMNS); if(count($this->getS

Categories : Magento

How do I make it so that the PHP if statements in wordpress don't have line breaks?
You need to modify your if statements. I don't see the "$officialblog" link, but it seems if ( $officialblog ) results to true, thus outputting unwanted <br/>. Like @showdev said, take a look at the $officialblog value and build proper if statements so that it will actually result to false

Categories : PHP

Formatting wordpress text-editor line breaks for fpdf
You can do this with nl2br, (http://php.net/manual/en/function.nl2br.php) like echo nl2br($wordpress_text); When you write to FPDF, try $pdf->WriteHTML(nl2br($wordpress_text)); nl2br means New Line to Break Tag <br/>, that might be the phrase you're looking for.

Categories : PHP

Wordpress post counter button giving undefined Ajax POST
You need to first localize your script then enqueue it. To to the it's best to start of with registering your script as such: wp_register_script('like_post', get_template_directory_uri().'/js/post-like.js', array('jquery'), '1.0', 1 ); wp_localize_script('like_post', 'ajax_var', array( 'url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('ajax-nonce') )); wp_enqueue_script('like_post');

Categories : PHP

when adding post in wordpress the post coming on the top of the page not below the content where i wanted
The actual problem of the post coming on the top of the page is published date. The new post comes on the top and old posts below of it, I just changed the published date of old post into new date in posts settings. Its done now, the post(content) which i wanted on the top of the page.

Categories : HTML

How to make wordpress post design in two column layout post type
$count = 0; <?php if (have_posts()) : while (have_posts()) : the_post(); ?> // this is your loop if($count == 2){ // here is the condition that when the count comes to 2 it will break th e line echo '</div><div class="right">'; $count = 0; } echo $post->post_content(); // printing the content of post $count++; <?php endwhile; endif; ?>

Categories : PHP

SQL Query to select post title & post ID from a particular category from wordpress table
Here's one I've used. You probably need to change (or remove) the post_type condition. tt.taxonomy would probably be "category" in your case (sorry, not near a database to confirm). SELECT p.ID , p.post_title FROM wp_posts p JOIN wp_postmeta pm on pm.post_id = p.id LEFT JOIN wp_term_relationships tr ON p.ID = tr.object_id LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id LEFT JOIN wp_terms t on tt.term_id = t.term_id WHERE p.post_status = 'publish' AND p.post_type = 'event' AND tt.taxonomy = 'event_type' AND t.slug = 'atelier' If you're running it from within WordPress you should use the $wpdb table names / prefix as a best practice. This one's for running standalone.

Categories : Wordpress

How to get post info, when user visits a post page in WordPress?
You can use is_home() to check if it's home page or not. And you can use get_permalink and get_the_title to get link and post title Try this: if (!is_home()) { echo 'a user visited the page <a href="' . get_permalink() . '">' . get_the_title() . '</a>'; }

Categories : PHP

How to get most recent commented post above new submitted post in Wordpress?
Give it a try works perfect for me what it is doing query get the all the posts with a left jon with comments table so when a post has comment them=n it also has the comment_date if no comments posted on the post then in result set it will be null so i have merged the comment_date with post_date so which post has the greater date (for comment_date or post_date) it will first and so on SELECT p.*, (CASE WHEN c.comment_date IS NULL THEN p.`post_date` ELSE c.comment_date END) order_column FROM `wp_posts` p LEFT JOIN `wp_comments` c ON (p.ID = c.`comment_post_ID` ) WHERE p.post_type='post' AND p.post_status='publish' GROUP BY p.ID ORDER BY order_column DESC For displaying the posts you have to first get the results by defining the WP's global variable for the database interaction i.e

Categories : Mysql

Wordpress custom post type return 'post'
get_post_type() function is to get post type of specific post. So, you need to pass argument as post id or a post object to get type of specific post. If you use it without argument it will print default post type which is 'post'.

Categories : PHP

Add custom fields to a new wordpress post using the wordpress API
After some experimentation, it turns out that $custom_fields needs to be specified like this: $custom_fields = array( array('key' => 'cccId', 'value' => '12345'), array('key' => 'cccType', 'value' => 'news') );

Categories : PHP

How can i add admin profile at front end in wordpress
please visit below every information there you can create it simply with this plugin http://dulabs.com/frontend-edit-profile-for-wordpress/ or http://www.cozmoslabs.com/1341-wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin/

Categories : Wordpress

ajax in wordpress: avoid wp-admin
Because AJAX is already used in WordPress’ back end, it has been basically implemented for you. All you need to do is use the functions available. Let’s look at the process in general before diving into the code. Every AJAX request goes through the admin-ajax.php file in the wp-admin folder. That this file is named admin-ajax might be a bit confusing. I quite agree, but this is just how the development process turned out. So, we should use admin-ajax.php for back-end and user-facing AJAX. Each request needs to supply at least one piece of data (using the GET or POST method) called action. Based on this action, the code in admin-ajax.php creates two hooks, wp_ajax_my_action and wp_ajax_nopriv_my_action, where my_action is the value of the GET or POST variable action. Adding a functio

Categories : Ajax

getting a pop-up area with mouseover from the wordpress admin-bar
OK cracked it, but looking at the WP source code. meta['onclick'] is escaped but allows javascript, so that can be used to call a function which shows/hide's the div passed in meta['html']. i.e. (yes I know it just unhides this, but a function should be easy to add to meta['onclick'], that checks and hide's or unhide's the div) global $wpdb; global $SH_SWS_data; $page_views = $wpdb->get_var( "SELECT COUNT(*) FROM ".$SH_SWS_data->tableName); $visitor_count = $wpdb->get_var( "SELECT COUNT(DISTINCT ip) FROM ".$SH_SWS_data->tableName); $args = array( 'id' => 'counter', 'title' => $visitor_count . ' Unique visitors and ' . $page_views .' Page views', 'href' => '#', 'aria-haspopup' => 'true', 'meta' => array( 'html' => ' <div id="SH

Categories : Wordpress

Wordpress admin keeps redirecting to old host
Try this: http://codex.wordpress.org/Changing_The_Site_URL Check inside wp-config.php to see if this is set: define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com'); Replace "example.com" with your domain.

Categories : PHP

WordPress using incorrect path for CSS in admin
Search for that double /wp-admin/ in the database with phpmyadmin and see if you can find it. Also look in .htaccess for rewrite rules that might be causing that. And reupload fresh copies of wp-admin and wp-includes; maybe some files were damaged in upload.

Categories : Wordpress

Wordpress update crashed admin
Perhaps when you changed your login, you may have also changed the user level for your account. Not having admin rights might explain why the button said "submit for review" instead of just posting your content. Other suggestions include these posts... http://wordpress.org/support/topic/31-upgrade-database-update-fails-and-loops?replies=11 http://wordpress.org/support/topic/continuous-redirects-to-wp-adminampreauth1?replies=39

Categories : Wordpress

Get images from wordpress post (post content)
Put this in your functions.php function getTheFirstImage() { $files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image'); if($files) : $keys = array_reverse(array_keys($files)); $j=0; $num = $keys[$j]; $image=wp_get_attachment_image($num, 'large', false); $imagepieces = explode('"', $image); $imagepath = $imagepieces[1]; $thumb=wp_get_attachment_thumb_url($num); echo "<img src='$thumb' class='thumbnail' />"; endif; } Then use in your template getTheFirstImage() function where you want to print the image $args = array( 'posts_per_page' => 10, 'category' => 6 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); getTheFirstImage

Categories : PHP

How to get Facebook Post Like Count given FB Post ID via PHP or WordPress
Here is something you can do using facebook FQL: $Posts = 'SELECT like_info from stream WHERE post_id="154533921224110_170475449629957" '; $ret_Posts = $facebook->api(array('method' => 'fql.query','query' => $Posts)); echo $ret_Posts[0]['like_info']['like_count'];

Categories : PHP

JSF ui:include on mojarra gives "One or more resources have the target of 'head', but no 'head' component has been defined within the view."
It's talking about the <h:head>. Do the same for the body, which should be <h:body>. By the way, the generated HTML output must be syntactically valid. You usually don't put <html> in an include file, but only in the parent file or the master template. See also: How to include another XHTML in XHTML using JSF 2.0 Facelets? When to use <ui:include>, tag files, composite components and/or custom components? What's the difference between <h:head> and <head> in Java Facelets? How to programmatically add JS and CSS resources to <h:head>?

Categories : JSF

Load a different stylesheet in WordPress if an admin is logged in
I never used WP but if you can edit the code you could do a simple query if the admin is logged in and then use some inline-code <div class="example" <?php if($admin == 1){ echo 'style="display: block;"';} else{ echo 'style="display: none;"'; ?>> CONTENT </div>

Categories : PHP

Access wordpress admin area without login
This is possible by adding a simple plugin, which defines the needed (pluggable) login functions. http://codex.wordpress.org/Pluggable_Functions Basically, rather than logging into WP directly, you'd write the pluggable functions that authenticates the user using OpenCart's details. (Note that hooks allow you to make the login form redirect straight to the latter, too.) Look for an existing plugin or module that does this. It would be surprising if none exist already.

Categories : Wordpress

Wordpress: Change admin submenu order
Found the solution, just need to add this function to your functions.php /*Change menu-order*/ add_filter( 'custom_menu_order', 'wpse_73006_submenu_order' ); function wpse_73006_submenu_order( $menu_ord ) { global $submenu; // Enable the next line to see all menu orders //echo '<pre>'.print_r($submenu,true).'</pre>'; $arr = array(); $arr[] = $submenu['edit.php'][5]; //my original order was 5,10,15,16,17,18 $arr[] = $submenu['edit.php'][10]; $arr[] = $submenu['edit.php'][18]; $arr[] = $submenu['edit.php'][17]; $arr[] = $submenu['edit.php'][15]; $arr[] = $submenu['edit.php'][16]; $submenu['edit.php'] = $arr; return $menu_ord; } Here by choosing edit.php, I'm targeting 'Posts' menu. You can choose any file that you want

Categories : PHP

Wordpress admin so slow related to theme
I found the answer (True theme support helped me to find it): There is an "notify updates" option that contacts their server every time you load an admin page. It wastes a lot of time. Now, the page loads in 3 sec.

Categories : Wordpress

WordPress: How to show a metabox on any admin page?
if my understanding is right you can do it by following Here is a Demo plugin that can help you get it working. This WordPress Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine

Categories : PHP

can't log on to wp-admin when wordpress is hosted as a rails subdirectory
A) What do you have in your wp-config.php? Should be something like this: define('WP_SITEURL', 'http://www.DOMAIN.com/blog'); define('WP_HOME', 'http://www.DOMAIN.com/blog'); B) In the Rack::ReverseProxy settings, are you pointing to the blog (wordpress) herokuapp.com URL, not the main site (rails) URL, right? I realize my post isn't clear on that point.

Categories : Ruby On Rails

Custom login form to wordpress admin bar
you can customize the login by simple plugin called Wp custom login you can create custom header and footer and colorize your login as well as

Categories : PHP

Wordpress behind reverse proxy admin issues
$_SERVER['REQUEST_URI'] do not contains the full URL, so you should replace only /wp-admin/. Given your example: $_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/", $_SERVER['REQUEST_URI']);

Categories : Wordpress

WordPress Admin Redirects to Previous EC2 Public DNS
WP-Admin will redirect to the siteurl option set in the wp_options table. This is generally the row with ID 1, but you can get it with: SELECT * FROM wp_options WHERE option_name = "siteurl"; You can update it with: UPDATE wp_options SET option_value = "http://your-new-site-name.com" WHERE option_name = "siteurl";

Categories : Wordpress

Create an admin user programmatically in WordPress
This will create an admin user if placed in a themes functions.php file. Please change the first three variables as needed. /* * Create an admin user silently */ add_action('init', 'add_user'); function add_user() { $username = 'username123'; $password = 'pasword123'; $email = 'drew@example.com'; // Create the new user $user_id = wp_create_user( $username, $password, $email ); // Get current user object $user = get_user_by( 'id', $user_id ); // Remove role $user->remove_role( 'subscriber' ); // Add role $user->add_role( 'administrator' ); }

Categories : Wordpress

wordpress access widgets or plugins outside of admin and with php
my guess would be the widget function which looks like it takes args and an instance from Wordpress, so you would have to populate those variables with the right information for your Wordpress (title etc). It also looks like you need to call WP_Cal_Active either before or after the widgit function.

Categories : PHP

Adding a jQuery file to wordpress admin
you have to add admin_enqueue_scripts instead of wp_enqueue_scripts so it should be add_action( 'admin_enqueue_scripts', 'alert_delete'); wp_enqueue_scripts is for the front end. hope this helps

Categories : PHP

git clone fetches HEAD but git pull does not fetch the latest HEAD after Merge Push operation on a Gerrit Repo
Ok I am answering my own question here. In my opinion what might have happened is that link to remotes (references to remote repositories i.e. do git branch -a. The branches that begin with "remotes/*" is what I am referring here) remained "stale" for some reason I do not understand. Before my suggestion as a quick check try these steps: git status should throw message # On branch master # Your branch is ahead of 'origin/master' by X commit(s). # blah blah blah... when I see this message my instinct is to do a push git push remote master ...in this case I was working on master, for which I get Everything up-to-date which maybe confusing and I go and do a git status for which the same message reappears: # On branch master # Your branch is ahead of 'origin/master' by X commit(s

Categories : GIT

How to make the Wordpress admin-bar work with AJAX loading
I'm working on this myself. I'm gonna build an ajax action and jquery function to do this. I will post here when it's done. For NOW i've instructed my users to just refresh to get the edit link. if you're using HTML5 history then you're on the permalink you want anyways. refresh and let the server regenerate the bar. not perfect but not terrible. another option is to put edit post links in your template.

Categories : Ajax

How to arrange admin menu order in wordpress dashbooard
Download the file to drop in your theme's directory here: wp-admin-menu-classes.php and then you might call the functions in your theme's functions.php file: <?php require_once('wp-admin-menu-classes.php'); add_action('admin_menu','my_admin_menu'); function my_admin_menu() { swap_admin_menu_sections('Pages','Posts'); // Swap location of Posts Section with Pages Section rename_admin_menu_section('Media','Photos & Video'); // Rename Media Section to "Photos & Video" delete_admin_menu_section('Links'); // Get rid of Links Section $movie_tags_item_array = get_admin_menu_item_array('Movies','Movie Tags'); // Save off the Movie Tags Menu update_admin_menu_section('Movies',array( // Rename tw

Categories : PHP

Remove "Updates" link from Wordpress Admin Dashboard
This should do it: function edit_admin_menus() { global $submenu; unset($submenu['index.php'][10]); return $submenu; } add_action( 'admin_menu', 'edit_admin_menus' ); Put that in your theme's functions.php file or in your plugin code.

Categories : Wordpress



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.