crontab -e
To edit:
44 3 * * * echo "hello world" > hello.txt
crontab -e
To edit:
44 3 * * * echo "hello world" > hello.txt
cut -d: -f1 /etc/passwd
runuser -l user -c 'cd /var/; ./file'
crontab -l -u user
If you need a new url to be the primary one for your WordPress site, read on.
Point the new domain by editing the A record for the domain to point to the IP of the server.
Copy the original virtual host to create the new one and then edit it:
cp /etc/apache2/sites-available/original.com.conf /etc/apache2/sites-available/new.com.conf
nano /etc/apache2/sites-available/new.com.conf
Just update the domain information part, not the directory it points to.
Enable the new virtual host:
a2ensite new.com.conf
Restart apache2 to see the new domain in effect:
service apache2 restart
When you visit the website now, you’ll be able to visit with both domains. The original domain will show all files and images correctly, while the new domain the site will look a little broken.
You need to update the database to use the new domain for the wp_siteurl, wp_home and all links to files and images. There are two ways to do this.
Drop all tables from the live website and then upload your new sql file from WP Migrate or your edited one from EditPad Lite into the database.
Now if you visit the new domain, the images will load correctly. You will also be able to see the original domain which we’ll need to change as only one should be primary.
Update your htaccess file at the top to redirect all domains to the new domain:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^new\.com$ [NC]
RewriteRule ^(.*)$ https://new.com/$1 [R=301,L]
Now the domain is updated for your WordPress site!
mkdir dir1
Change wordpress url using wp-config.php
<?php
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
<?php
$response = wp_remote_get( add_query_arg( array(
'per_page' => 3
), 'https://domain.com/wp-json/wp/v2/posts' ) );
if( !is_wp_error( $response ) && $response['response']['code'] == 200 ) {
$posts = json_decode( $response['body'] ); // our posts are here
foreach( $posts as $post ) {
$date = date('F j, Y', strtotime($post->date));
echo '<div class="blog-post-date">' . $date . '</div>';
echo '<h3 class="blog-post-title">'. $post->title->rendered . '</h3>';
echo $post->content->rendered;
//$output .= print_r( $post );
}
}
<?php
function site_inline_scripts() {
global $current_user;
$property_ga4 = "CONTAINER";
$staging = false;
if($_SERVER['HTTP_HOST']!="domain.com"){
$property_ga4 = "CONTAINER2";
$staging = true;
}
if ( !isset( $current_user->roles[0] ) || $current_user->roles[0] == 'customer' || $staging == true) {
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','<?php echo $property_ga4; ?>');</script>
<!-- End Google Tag Manager -->
}
}
add_action('wp_footer', 'site_inline_scripts', 17);
<?php
echo date('F j, Y', strtotime($remote_post->date));