WordPress Child Theme Code

  • Create these files first
    • functions.php
    • style.css
    • style-mobile.css
    • script.js
for functions.php
<?php
  function my_theme_enqueue_styles() {
    $parent_style = '../Divi';
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );

    wp_enqueue_style( 'child-styles', get_stylesheet_directory_uri() . '/style.css');
    wp_enqueue_style( 'child-style-mobile', get_stylesheet_directory_uri() . '/style-mobile.css');

    wp_enqueue_script('child-scripts', get_template_directory_uri() . '/script.js' );
  }
add_action("wp_enqueue_scripts","my_theme_enqueue_styles");
?>

for script.js

jQuery(document).ready(function( $ ) {
  console.log('Ready!');
}

for style.css

/*
Theme Name: Divi Child
Description: A dev site
Author: Garth Baker
Template: Divi
*/

for style-mobile.css

@media only screen and (max-width:600px) {
  /*--------------------------------*/
}

Install Nemo File Manager on Ubuntu

Install Nemo File Manager On Ubuntu 17.04 Systems

Install Nemo on Ubuntu

To install Nemo in Ubuntu Systems, run the following command to add the Nemo WebUpd8 PPA:

sudo add-apt-repository ppa:webupd8team/nemo
sudo apt-get update
sudo apt-get install nemo nemo-fileroller

Please note that if you already have an older Nemo version installed, upgrade to the latest Nemo version, Run the following command to do so:

sudo apt-get update
sudo apt-get upgrade
killall nemo

Once installed, open the Nemo file manager from the Ubuntu Dash or menu. Please note that you won’t see Nemo icon, but if you search for “Nemo”, the “Files” option shows up. Click on it to open Nemo.

Adding a search filter to Outsystems

In the example below a local variable was created for orders WebScreen called “searchfilter” which was set as the Search inputs Variable.

There was an Orders Entity and a Customers Entity.

The text below is an aggregate filter checking for all the orders with customer names like the text input into the search box. Remember the “searchfilter” was set as a local variable for the Orders Entity.

Customer.Name like "%" + SearchFilter + "%"

Also because the Orders Entity and the Customers Entity were separate Entities a source was added for the Customers to link the tables so the customer Entity could be found.

The aggregate that had these setting was the “GetOrders” aggregate which was used in the Orders WebScreen preparation.

WP-Query Add Pagination

Firstly you have your while loop to run through all your posts.
And above your while loop you have your args.

You need to add this arg

$args['paged'] = $paged;

Below is a template to start your while loop

  $args['post_type'] = 'post';

  $query = new WP_Query($args);

  while ( $query->have_posts() ) : the_post(); ?>
    <?php 
      $query->the_post(); 
      $post_id = get_the_ID();
    ?>
    <div class="card">
      <a href="<?php the_permalink(); ?>" class="card-header text-center">
        <?php
          the_title();
        ?>
      </a>
      <div class="card-body">
        <?php
          the_content();
        ?>  
      </div>
    </div>
<?php endwhile; ?>

Your Args must be before your Query!

Then after your endwhile. Paste this code to display your pagination links

<div class="pagination">
    <?php 
        echo paginate_links( array(
            'base'         => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
            'total'        => $query->max_num_pages,
            'current'      => max( 1, get_query_var( 'paged' ) ),
            'format'       => '?paged=%#%',
            'show_all'     => false,
            'type'         => 'plain',
            'end_size'     => 2,
            'mid_size'     => 1,
            'prev_next'    => true,
            'prev_text'    => sprintf( '<i></i> %1$s', __( 'Previous', 'text-domain' ) ),
            'next_text'    => sprintf( '%1$s <i></i>', __( 'Next', 'text-domain' ) ),
            'add_args'     => false,
            'add_fragment' => '',
        ) );
    ?>
</div>

 

 

WordPress Login redirecting to strange url

Define('WP_SITEURL','https://your-site-url');
Define('WP_HOME','https://your-site-url');

The above code must get added to your wp-config.php File
It should fix the redirecting login issue.

I left in inside my file after using it and all seemed fine. So no harm in just keeping it.