Hot answers tagged

5

I want ot give you an "alternate" approach. I'm pretty sure you're not going to follow this, but I thinks is interesting to read. OOP "routing" approach In WordPress, "pretty" urls are mathed to "ugly" urls. But most web frameworks (not only PHP) uses the concept of "routing": to match an url to an "action" (or a controller). I want to give you an idea ...


5

I am not sure if this is the best solution or not, but it works: function movie_review_permalink( $url, $post, $leavename ) { $category = get_the_category($post->ID); if ( !empty($category) && $category[0]->slug == "test" ) { //change 'test' to your category slug $date=date_create($post->post_date); $my_date = ...


2

Well, AUTH_KEY and it´s brothers where introduced in WordPress 2.6 to improve safety for logged in users. They are used to encrypt and validate the information in your backend login cookie. While revealing the AUTH_KEY alone might not be a real security issue, you should nevertheless not output/use this anywhere to give less surface for attacks. ...


1

You can read data on your server with file_get_contents(). If you want to make sure the file exists and is readable then use is_readable(). You don't really need to use trailingslashit() in this case because you're constructing the URI yourself. // path to file under current theme $json_file = get_template_directory() . ...


1

It looks like you use the Jetpack Plugin with Photon function (Wordpress.com photo CDN) https://jetpack.me/support/photon/ https://developer.wordpress.com/docs/photon/ You have to deactivate the Photon option in the Jetpack plugin settings.


1

Kind of depends on where you are in the WordPress environment. Plugins If you're in a plugin, you can use plugins_url. <?php $url = plugins_url('css/admin.css', __FILE__); The above will give you the path relative to the file passed into the second argument. So if you're in the main plugin file you might get something like ...


1

The first form: <form method="post" action="some-url.php"> <input type="email" placeholder="Email address" value="" name="email"> <input type="submit" value="Submit" name="email-submit"> </form> Then in some-url.php: if( isset($_POST['email'] ) $email = $_POST['email'] The post method would be preferred here since it ...


1

If the front page is set to display posts then the query for those posts will run regardless of wether your theme shows these posts or not. That's why you're getting pagination with no posts. You can test this by temporarily removing your themes front-page.php (or whatever it is). You should see all your posts with correct pagination. You have 2 options to ...



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