Loading...

Follow WordPress Development Stack Exchange on Feedspot

Continue with Google
Continue with Facebook
or

Valid

I am having 2 header UK & US Header. I want to redirect the US header & footer based on US location.

I am using Geo Redirection Plugin, but by using this plugin i can modifiy the URL redirection, not able to change the header.

So please help to redirect the based on GEO Redirects

Thank you

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I have put a navwalker in my bootstrap wordpress which gives me a fatal error

Fatal error : Uncaught Error: Class 'WP_Bootstrap_Navwalker' not found in A:\xampp\htdocs\wordpress\wp-content\themes\Akiveb\header.php:29 Stack trace: #0 A:\xampp\htdocs\wordpress\wp-includes\template.php(688): require_once() #1 A:\xampp\htdocs\wordpress\wp-includes\template.php(647): load_template('A:\xampp\htdocs...', true) #2 A:\xampp\htdocs\wordpress\wp-includes\general-template.php(41): locate_template(Array, true) #3 A:\xampp\htdocs\wordpress\wp-content\themes\Akiveb\index.php(46): get_header() #4 A:\xampp\htdocs\wordpress\wp-includes\template-loader.php(74): include('A:\xampp\htdocs...') #5 A:\xampp\htdocs\wordpress\wp-blog-header.php(19): require_once('A:\xampp\htdocs...') #6 A:\xampp\htdocs\wordpress\index.php(17): require('A:\xampp\htdocs...') #7 {main} thrown in A:\xampp\htdocs\wordpress\wp-content\themes\Akiveb\header.php on line 29

Here is my header.php ` /css/bootstrap.css" >

<!-- Custom styles for this template -->
<link href="<?php bloginfo("stylesheet_url")?>" >
<?php wp_head(); ?>

" title=""> " alt="" />

      wp_nav_menu( array(
        'theme_location'  => 'primary',
        'depth'           => 2, // 1 = no dropdowns, 2 = with dropdowns.
        'container'       => 'div',
        'container_class' => 'collapse navbar-collapse',
        'container_id'    => 'navbarResponsive',
        'menu_class'      => 'navbar-nav mr-auto',
        'fallback_cb'     => 'WP_Bootstrap_Navwalker::fallback',
        'walker'          => new WP_Bootstrap_Navwalker(),
      ) );

      ?>
      </ul>
    </div>
  </div>
</nav>

`

And this is my functions.php

function remove_admin_bar(){
if (!current_user_can('administrator') && !is_admin()){
  show_admin_bar('false');
}

}

if ( ! file_exists( get_template_directory() . '/class-wp-bootstrap- 
navwalker.php' ) ) {
// file does not exist... return an error.
return new WP_Error( 'class-wp-bootstrap-navwalker-missing', __( 'It appears 
the class-wp-bootstrap-navwalker.php file may be missing.', 'wp-bootstrap- 
navwalker' ) );
} else {
// file exists... require it.
require_once get_template_directory() . '/class-wp-bootstrap-navwalker.php';
}


//Theme Support
function wpb_theme_setup(){
//nav Menus
register_nav_menus( array(
'primary' => __( 'Primary Menu'),
) );
}


add_action('after_setup_theme','wpb_theme_setup');




function prefix_modify_nav_menu_args( $args ) {
return array_merge( $args, array(
'walker' => WP_Bootstrap_Navwalker(),
) );
}
add_filter( 'wp_nav_menu_args', 'prefix_modify_nav_menu_args' );
?>
Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I was looking at the Conditional Tags Archive and was wondering if it's possible to show a widget depending on different posts / pages a visitor has previously viewed.

For example, if I had a car blog and the blog layout contains a sidebar widget that will display a promotion.

This promotion will vary depending on the types of posts a visitor has viewed.

So if a visitor was looking at posts that have to do with the Mazda brand, I'll be able to write a condition for the widget in the sidebar that reads, if he visited blog post X, Y or Z, then this widget will display a promotion for a Mazda Car Dealership near him.

Same for other car types and promotions.

I'm guessing some would it'd be impossible, but I was thinking if tracking a visitor with cookies, it would seem like a viable idea.

Thoughts or suggestions on where to go from here?

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I'm working on a website for a customer who gets orders from call center ( runs ad on TV). The call center receives the customer info on the phone and sends them to him by the end of the day. Right now a company tries to add the orders to woocomerce for him and I need to do this from now on. The call center sends an .cvs file or .xml. I tried to use a plugin which imports orders / subscriptions to woocommerce. But the problem is that there is no credit card column for this plugin. I troed to add an order manually, I saw that woocommerce asks me to enter the token number for the credit card!! It doesn't ask me for the credit card number of the customer. Would you pls help me on how to add a customer purchase info to woocomerce? Imagine I have their credit card info, billing address, shipping address and ...

Thanks in advanve

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

could you advise me on what is the best method to deal with this case.

I work in a task in which when uploading a file with xlsx extension I must process the information of this file and include the data in metadata of a post. There may be several hundred records in the .xlsx file. The logic is implemented. But the process may take several minutes. My questions is: What is the correct way to do so that this process is executed in the background and when it conclude notify the user with some message in the view. I thank you for your comments.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I wrote the following code, which works fine in displaying a hex value if its not set, or if its set already.

I want to save the selection of the colorpicker, using the save button, but something is wrong here - since once I press it, not only it is not saved, but an error regarding not found options.php comes back from WordPress.

I am wondering how to save the new selection.

<?php 

function my_overlay_callback() {

if( !isset( $options['textcolor'] ) ) add_option('textcolor', '#f48854'); 
echo '<input  type="hidden" name="header_color" value="' . get_option('textcolor') . '"/>';

}

?>

<div >


       <?php my_overlay_callback(); ?>


    <form method="post" action="options.php">
    <?php
    settings_fields("textcolor");
    do_settings_sections("textcolor");

?>
     </form>

</div>
Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I'm using these two lines:

$expires = strtotime( $_POST['expire_date']);
if($expires < time())

to test the time in the name=expire_date form against GMT time. But no matter what I do my expire date time is 5 hours off. I'm in GMT -5, so I'm trying to adjust the top line:

$expires = strtotime( $_POST['expire_date']) - (( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ));

But it's not working. Any ideas for correct GMT offset handling in Wordpress?

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

My WPLMS site and dashboard are working normally. However when I go to the pages and go to edit a page, it takes me to a blank page with no content and no error message.

Editing course content works normal. This problem seems to only occur on the pages.

I have tried disabling all plugins and gone through the php to find any culprits, but nothing seems to solve the problem.

Any ideas on how to solve this problem would be very helpful, thanks!

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I have a localhost website bm.ourdomain.local on our Mac machine (running AMPPS).

It has an entry in /etc/hosts:

<local IP> bm.ourdomain.local

It has an entry in /Applications/AMPPS/Apache/conf/extra/vhosts.conf:

<VirtualHost *:80>
    ServerAdmin hello@ourdomain.local
    DocumentRoot "/Applications/AMPPS/www/bm.ourdomain.local"
    ServerName bm.ourdomain.local
    ServerAlias bm.ourdomain.local
    ErrorLog "/Applications/AMPPS/www/bm.ourdomain.local/error_log"
    CustomLog "/Applications/AMPPS/www/bm.ourdomain.local/access_log" common
</VirtualHost>

When I load bm.ourdomain.local in Chrome, nothing happens, the loading icon just spins.

If I turn on debug, debug.log doesn't get created.

If I rename plugins to plugins.temp, nothing changes, same with themes to themes.temp.

There is Wordfence installed, and I have confirmed .htaccess and .user.ini contain the correct path to wordfence-waf.php.

There is no error_log.

If I clear the browser cache of files and cookies, nothing changes.

Other websites on the local server run fine, on vhosts.

Help appreciated.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I'm running a column sort in my posts listing page using LEFT JOIN on a custom table that records page views. You could say I am sorting by page views.

Here's what my query extra pieces look like:

Array ( [where] => AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'unsent' OR wp_posts.post_status = 'cancelled' OR wp_posts.post_status = 'sending' OR wp_posts.post_status = 'refunded' OR wp_posts.post_status = 'failed' OR wp_posts.post_status = 'revoked' OR wp_posts.post_status = 'abandoned' OR wp_posts.post_status = 'processing' OR wp_posts.post_status = 'active' OR wp_posts.post_status = 'inactive' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'edd_subscription' OR wp_posts.post_status = 'preapproval' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') [groupby] => wp_posts.ID [join] => LEFT JOIN wp_inbound_page_views ee ON ee.page_id = wp_posts.ID AND ee.datetime >= '2018-12-02 19:11:14' AND datetime <= '2018-12-10 19:11:14 ' [orderby] => COUNT(ee.page_id) ASC [distinct] => [fields] => wp_posts.* [limits] => LIMIT 0, 10 )

The custom table wp_inbound_page_views has 1.4 million entries. I have about 500 posts to calculate total impressions.

(Maybe)Due to the high number of records in my custom wp_inbound_page_views table I'm seeing 502 timeouts. It also could be a structural error.

Is there anything I can do to speed up my query and prevent these timeouts? Why does Right Join work and Left Join timesout in this context?

Here's a link to the code in action:

https://github.com/inboundnow/inbound-pro/blob/e91ef8c7f1538fe13110db368364976f2b8a02e0/classes/admin/class.inbound-analytics.php#L360-L368

Here's an example SQL query that receives a timeout. Change that LEFT to RIGHT though and it works:

SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_inbound_page_views ee ON ee.page_id = wp_posts.ID AND ee.datetime >= '2018-09-10 21:10:12 ' AND datetime <= '2018-12-10 21:10:12 ' WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'unsent' OR wp_posts.post_status = 'cancelled' OR wp_posts.post_status = 'sending' OR wp_posts.post_status = 'refunded' OR wp_posts.post_status = 'failed' OR wp_posts.post_status = 'revoked' OR wp_posts.post_status = 'abandoned' OR wp_posts.post_status = 'processing' OR wp_posts.post_status = 'active' OR wp_posts.post_status = 'inactive' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'edd_subscription' OR wp_posts.post_status = 'preapproval' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY COUNT(*) ASC LIMIT 10, 10

Read Full Article

Read for later

Articles marked as Favorite are saved for later viewing.
close
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview