jgraup
  • Member for 6 years, 2 months
  • Last seen more than a month ago
How to use a class within a cron job function
Accepted answer
1 votes

You're calling a function with variables that are not defined and are required for the function to work correctly. function hourly_function() { $newClass = new newClass(); $var1 = 'this ...

View answer
Setting Up PHP Workflow in Wordpress
Accepted answer
1 votes

Having a local environment that is the same for all devs is pretty easy to setup using vccw.cc or basic-wordpress-vagrant. Use Git for plugins and themes -- each as their own repo. Free private ...

View answer
How do I change the hover (focus) color of admin bar from frontend?
Accepted answer
1 votes

switch your hook to ['admin_bar_menu'] and make things !important. add_action( 'admin_bar_menu', 'change_bar_color1' ); function change_bar_color1() { ?> <style> #...

View answer
Hosting wordpress on Amazon
1 votes

Read up on using WordPress on an EC2 in AWS. You'll first need to create a LAMP stack. Chances are, if you couldn't google that far, you'll need to find someone to do it for you.

View answer
How to get default permalink link text?
1 votes

You can concatenate a url with the ID using get_site_url. This assumes the ID is valid. <?php echo get_site_url(null, '/?p=' . get_the_ID() ); ?> Although wp_get_shortlink() above seems ...

View answer
Missing URL in password reset email
1 votes

Check out the wp-login.php on GitHub. The default blocks looks like: // Redefining user_login ensures we return the right case in the email. $user_login = $user_data->user_login; $user_email = $...

View answer
When listing child pages run out of memory
1 votes

WP_Query has Pagination_Parameters like posts_per_page and offset to help you out. Just page the results to limit the query to a more reasonable number per page.

View answer
Count foreach and display in menu php
1 votes

You're incrementing $count but I see you're referencing $counter. Not sure if those are different but here is a version that uses the same variable in all those places. $counter = 0; //Hier ist der ...

View answer
How to get attached image to taxonomy..?
1 votes

If your going to reference the uploads directory use https://developer.wordpress.org/reference/functions/wp_upload_dir/ <?php $upload_dir = wp_upload_dir(); // Array of key => value pairs /* ...

View answer
How can I update post meta inside a WP_Query loop or the WordPress loop?
1 votes

The Loop is PHP code used by WordPress to display posts. You can see how a loop is constructed on generatewp.com. // WP_Query arguments $args = array (); // The Query $query = new WP_Query( $args ); ...

View answer
how to import a custom website into Wordpress
Accepted answer
1 votes

There is documentation on how to create a theme on the codex: Theme Development. You can also get started quickly with basic starter themes; underscores. There are also tools that you can use to ...

View answer
Cronjob returns a lot of REMOTE_ADDR, SERVER_PORT, SERVER_NAME, etc errors
Accepted answer
1 votes

You're getting Undefined index errors because you're loading the files directly and not rendered through the server. The server typically populates those values and it's actually more secure to run ...

View answer
Database Update Required - Update from command-line
1 votes

Core updates are supported in the WP-CLI. wp core update - Update WordPress. # Update WordPress $ wp core update Updating to version 4.5.2 (en_US)... Downloading update from https://downloads....

View answer
How to remove "» (title of post or page)"?
Accepted answer
1 votes

Search your code for » and narrow down where it's referenced. Chances are not many places. Look in all your theme and plugin folders. Even do a grep on the /wp-content folder. grep -winr ./wp-content ...

View answer
How to authenticate a user with an external webservice
1 votes

Read up on REST API Authentication here. There has been talk of a WP REST API Application Registry on Make WordPress Core's blog - WP REST API: Introducing the Authentication Broker, which would ...

View answer
What's the best way to install Wordpress?
1 votes

Use WP-CLI's - wp core install - Runs the standard WordPress installation process. Creates the WordPress tables in the database using the URL, title, and default admin user details provided. ...

View answer
Preventing YouTube embeds loading multiple instances of player JS?
1 votes

Google I/O 2011: YouTube's iframe Player: The Future of Embedding will tell you all about the past's future. You might be able to find an alternative on to iFrame on the YouTube Developer section but ...

View answer
Compressing JS and CSS
1 votes

Use a tool like Gulp to minify using NodeJS packages. Gulp Uglify for JS, Gulp CSS Min for CSS. As for GZip, you'll need to enable that on your server config - Apache using mod_deflate in .htaccess ...

View answer
Embed/Link external web pages into my WordPress blog (Like Facebook grabs Image, Title, and Description)
1 votes

Looks like you might be describing embeds which WordPress supports. On https://codex.wordpress.org/Embeds you'll find a long list of currently supported embeds simply based on the URLs added in your ...

View answer
track all external links on blog via username
1 votes

I realize someone basically made my comment and added as an answer. Here is a fully working version using the built in REST API for variety. It was a little tricky finding docks on authenticated ...

View answer
How to display custom post type?
1 votes

Adding pre_get_posts is too late if subscribed in a page template and your template is empty so that's the reason nothing it showing. Move your pre_get_posts out to your functions.php so it has a ...

View answer
How to pass arguments to add_action() or retrieve return value of called function?
Accepted answer
1 votes

It's possible to use functions in a way that allow for one action to pass variables to the next. In this case, I've waited till the wp_head event to add the_content filter. And it will be using the ...

View answer
Section Background Images?
1 votes

You need to modify your theme pages to support this change. If you already have a background in place you can modify it on a per post basis using the technics describe in that post. This plugin ...

View answer
Show Post Content with AJAX
1 votes

Create the JSON endpoint that accepts a WP_Post ID. add_action( 'rest_api_init', function() { register_rest_route( 'api/v2', '/post/(?<id>\d+)', array ( 'methods' => 'GET', ...

View answer
how can I show name and value of Custom Fields together?
1 votes

I think what you're looking for is concatenation with . <?php $key = "yourkey"; echo $key . ": " . get_post_meta( $post->ID, $key, false ); ?>

View answer
Adding JS to one page
1 votes

Check your page with is_page in wp_enqueue_scripts just in time for wp_add_inline_script. add_action( 'wp_enqueue_scripts', function() { if ( is_page( 'your-page-name' ) ) : ob_start(); ?> ...

View answer
How can I create a bash install script for my Wordpress sites setup (WP+plugins+theme)?
1 votes

Create the bash script: touch wp_plugins_theme.sh Make Executable: chmod +x ./wp_plugins_theme.sh Copy this into it: #!/bin/bash # # This script is to automate a common WP setup. # # - ...

View answer
How to delete all posts, categories and tags from Wordpress database
1 votes

Use WP-CLI to remove all tables from the database in MySQL. Runs DROP_DATABASE and CREATE_DATABASE MySQL statements using DB_HOST, DB_NAME, DB_USER and DB_PASSWORD database credentials specified in ...

View answer
Set featured image from custom field URL
1 votes

Hook 'acf/save_post' after ACF saves the $_POST['acf'] data. Then check to see if the post has_post_thumbnail and set_post_thumbnail if it doesn't. function save_acf_image_to_post_thumbnail( $post_id ...

View answer
Generate WP-CLI @alias for each site on multisite
1 votes

LOCAL For local aliases, it works best to define your path ahead of time in the config.yml. Then keep the variables pretty clean by only specifying the url to target the site. Sorting the output ...

View answer
1
3 4
5
6 7
13