Where can I create a normal php file?

For example, I create a file: json.php, and I put it in the wp-content folder and try to acess it like that: www.example.com/json.php, but I get the error. That is because the path is wrong. If you put the file in your theme the path to the file is http://example.com/wp-content/themes/your-theme-name/your-file.php, not http://example.com/your-file.php. That path points … Read more

Pull Tags But Not as Links

You can use get_the_terms(). I’ve adapted the following from an example on that page: $terms = get_the_terms( $post->ID, ‘visits’ ); if ( $terms && ! is_wp_error( $terms ) ) : $visits_name = array(); foreach ( $terms as $term ) { $visits_name[] = $term->name; } $terms_list = join( “, “, $visits_name ); echo $terms_list; endif; EDIT: … Read more

Fatal Errors on pluggable.php

Don’t mess around with changing those files directly. It will break when that file gets changed in an update. Do this instead. add_filter( ‘wp_mail_from’, ‘override_mail_from_address’ ); add_filter( ‘wp_mail_from_name’, ‘override_mail_from_name’ ); function override_mail_from_address($email_address) { $from_array = explode(‘@’, $email_address); $from_address = $from_array[0]; $from_domain = $from_array[1]; if (strtolower($from_address) == ‘wordpress’) { $from_address = “myname”; /* Put the email … Read more

Widgets in the loop if active

Think about what is happening. You run the_post(); which sets $post to the first post in the Loop, but you don’t use that post if your sidebar is active. Then the Loop continues and $post gets set to the second post in the Loop. You’ve lost your first post. I don’t see why that first … Read more

WordPress page content outside WordPress

The alternative way. Problem with @david.binda solution is that: you have to hardcoding a lot of things, (manually write db credientials, table prefix..) You cannot use content filter (so if you have shortcode in your page, you will see some [something] instead of desired content..) sure you can load wordpress environment, but… Just yesterday I … Read more

Get author and excerpt from URL

There is a function called url_to_postid $id = url_to_postid( get_permalink(40) ); // $id will be 40 Actually (WP 3.6) it works only for standard posts and page, but with WP 3.7 it will also work for custom post types.

wp_dropdown_pages auto submit

You can use the following piece of code. <form action=”<?php bloginfo(‘url’); ?>” method=”get”> <?php $select = wp_dropdown_pages( array( ‘post_type’ => ‘ce_artists’, ‘show_option_none’ => ‘Select Artist’, ‘echo’ => 0 ) ); echo str_replace(‘<select ‘, ‘<select onchange=”this.form.submit()” ‘, $select); ?> </form> You can find a similar example here in the codex

WordPress displaying content from sub pages

It sounds like you may be looking for wp_list_pages(): $args = array( ‘child_of’ => $post->ID ); wp_list_pages( $args ); With the appropriate arguments I am almost certain that you can do what you need with that function.

I restricted wordpress by logged users. It’s possible exclude a page?

I wanted to restrict my website except a specific page. This is my solution: function restrict_access_if_logged_out(){ global $wp; if (!is_user_logged_in() && !is_home() && ($wp->query_vars[‘pagename’] != ‘name-of-page’) ){ $redirect = home_url() . ‘/wp-login.php?redirect_to=’ . esc_url($_SERVER[“HTTP_HOST”] . urlencode($_SERVER[“REQUEST_URI”])); wp_redirect( $redirect ); exit; } } Only I added this: && ($wp->query_vars[‘pagename’] != ‘name-of-page’) in IF clause and a … Read more