jQuery Ajax not loading page with ACF fields

I’m using the following jQuery code to load contents from a template part into another on click. Without the ACF PHP tags, it works. However, when I add these tags in <?php the_field('field_name'); ?> it throws a 500 (Internal Server Error) error. Does anyone have a solution for this, please?

    var baseUrl = "http://projectname:8888/wp-content/themes/custom-theme"      $  (".cross__functional").click(function (e) {         e.preventDefault();         console.log('cross functional Clicked')         $  ("#keContent").load(baseUrl + "/template-parts/components/filename.php");     }); 

Why am i getting “missing right parenthesis” error when i try to LOG ERRORS when loading from an external table?

I’ve successfully created an error logging table

BEGIN     DBMS_ERRLOG.create_error_log(     dml_table_name  => 'enzyme',     skip_unsupported => TRUE); END; /  desc ERR$  _ENZYME; 
Name            Null? Type            --------------- ----- --------------  ORA_ERR_NUMBER$         NUMBER          ORA_ERR_MESG$           VARCHAR2(2000)  ORA_ERR_ROWID$          UROWID          ORA_ERR_OPTYP$          VARCHAR2(2)     ORA_ERR_TAG$            VARCHAR2(2000)  ENZ_NAME              VARCHAR2(4000)  

But i get an error when I try to run this query:

insert /*+ ignore_row_on_dupkey_index ( enzyme ( enz_name ) ) */ into enzyme SELECT enz_name FROM EXTERNAL ((   construct_id NUMBER(10),   n_term VARCHAR2 (50),   enz_name VARCHAR2 (3),   c_term VARCHAR2 (50),   cpp VARCHAR2 (50),   mutations VARCHAR2 (50),   mw_kda NUMBER (7, 3))      TYPE ORACLE_LOADER     DEFAULT DIRECTORY data_to_input     ACCESS PARAMETERS (         RECORDS DELIMITED BY NEWLINE         skip 1         FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'         MISSING FIELD VALUES ARE NULL          )      LOCATION ('CONSTRUCT.CSV')     LOG ERRORS INTO ERR$  _ENZYME ('INSERT') REJECT LIMIT UNLIMITED) ext     where not exists (         select * from enzyme e         where e.enz_name = ext.enz_name     ); 
Error at Command Line : 79 Column : 5 Error report - SQL Error: ORA-00907: missing right parenthesis 00907. 00000 -  "missing right parenthesis" *Cause:     *Action: 

Line 79 is the LOG ERRORS INTO line.

If i delete the LOG ERRORS INTO ERR$ _ENZYME ('INSERT') part, this command functions perfectly.

How do I stop an Image Address from loading in the Browser?

Ultimately, I want to be able to disable the Right Click option across a website I am working on. I have managed to disable this across the Blog Content and all of the Images that appear within the Blog.

I have noticed that when you enter the Image address directly into the Browser, the Right Click still works. I have tried modifying the Code Snippets I have, as well as various Plugins, but nothing seems to work. Would it be a case that it is not possible to disable the Right Click option when loading the original image, by entering its Image address into the Browser?

Assuming this is the case, is it possible to prevent the Image from loading when entering the Image Address directly within the browser?

If there is a way, would this prevent the image from loading in Blog Posts etc too?

Loading scripts and stylesheets together failure

I’m trying to load scripts and stylesheets together at same function. At first I loaded stylesheet by itself and it worked after I added admin_enqueue_scripts function in additional to wp_enqueue_scripts.

Now I’m trying to load stylesheets and scripts in the same function, unfortunately that fails to exist, and also prevent CSS to load.

I can’t find any typo’s or something online that related to my issue.

  function loadAssets(){       wp_enqueue_style( 'style', get_template_directory_uri() . '/css/style.css');       wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery.js');       wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js');   }    //Applying those loading references   add_action('wp_enqueue_scripts', 'loadAssets');   add_action('admin_enqueue_scripts', 'loadAssets'); 

How can I load both JavaScript files and CSS files on the same function?

Error loading wp_editor via ajax in wordpress

I needed help. I’m creating a page external to wordpress and needed to add wp_editor. Here is a simplified example of my code:

<?   require('../wp-blog-header.php');   define('WP_USE_THEMES', false);   ...   <body>     <button onclick="get_editor_ajax()"></button>     <div id="editor_text"></div>     ...       function get_editor_ajax(){         ...         success: function(resp){           jQuery("#editor_text").html( resp );         }         ...       }     ...   </body> ?> 

function.php

function test_editor_text(){   wp_editor($  content, $  editor_id);   _WP_Editors::enqueue_scripts();   print_footer_scripts();   _WP_Editors::editor_js();   wp_die(); } add_action('wp_ajax_test_editor_text', 'test_editor_text'); 

Partly it’s working, but I have problems. 1st – clicking on the button “get_editor_ajax ()” makes the element below (attachment img) appear at the end of the page.

enter image description here

2nd – The add media button does not work. I believe it is because the necessary scripts are missing. One time, my page doesn’t use a theme, it doesn’t load wordpress scripts.

Note: When calling the get_editor_ajax () function more than once, I noticed that codes are being added before the closing of as in this other attached image.

enter image description here

I need help with these two problems. Thanks in advance.

Unpivot Source Table Before Loading as Fact Table

My question touches on defining the grain for a fact table given a source table that uses a common spreadsheet layout. First, credit to Clinton Daniel’s excellent videos on data mart design that inspired the examples here.

In Clinton Daniel’s videos, he uses a data set from the FBI showing crime data. The first few columns are for City, State and Year. Then the rest of the columns are labeled with certain crime categories (Murder, Assault, Robbery, etc.) and each row indicates the number of crimes of that type reported by the city in the given year.

 +-----------+----------+------+--------+---------+---------+   |   CITY    |  STATE   | YEAR | MURDER | ASSAULT | ROBBERY |   +-----------+----------+------+--------+---------+---------+   | Albany    | New York | 2015 |      5 |      19 |     300 |   | Albany    | New York | 2016 |      6 |      30 |     275 |   | Annapolis | Maryland | 2015 |     12 |      66 |     197 |   | Annapolis | Maryland | 2016 |     16 |      47 |     189 |   +-----------+----------+------+--------+---------+---------+   

What are the arguments for or against “unpivoting” this data before loading it to the data warehouse? Would your fact table keep each crime category in its own column like it is in the source? Or would you see that the Crime Category is more granular, meaning that you’d transform and load the data as below:

 +-----------+----------+------+----------------+--------+ |   CITY    |  STATE   | YEAR | CRIME_CATEGORY | NUMBER | +-----------+----------+------+----------------+--------+ | Albany    | New York | 2015 | Murder         |      5 | | Albany    | New York | 2015 | Assault        |     19 | | Albany    | New York | 2015 | Robbery        |    300 | | Albany    | New York | 2016 | Murder         |      6 | | Albany    | New York | 2016 | Assault        |     30 | | Albany    | New York | 2016 | Robbery        |    275 | | Annapolis | Maryland | 2015 | Murder         |     12 | | ...       | ...      |  ... | ...            |    ... | +-----------+----------+------+----------------+--------+ 

Are there guidelines on how to approach this? Or any resources (books, blogs) that address this?

A couple of other quick thoughts — I understand that the preferable grain in this case would be an individual crime itself, not already aggregated as this source data is. Would you handle it differently if the source table is already aggregated versus not aggregated?

Lastly, as information, my specific application has more to do with invoices. The columns in my source tables are Cost Categories (Parts, Labor, Fuel) and I contend my organization should be capturing each of those as individual rows of the fact table (i.e., unpivoted).

Thanks.

Best way for dynamically loading page content

I want to have the MyAccount-page of WooCommerce on a single page (~7 different pages, some include only tables with information and others forms to modify data) and dynamically load the content fired through button click.

Its maybe a simple question but I have multiple methods in my mind and also tried some but aren’t sure which way to go.

Important criterias are safety and performance (loading-speed)

Method 1:

  • Have all forms and tables invisible on the main-page and just request the necessary data via (jQuery)-Ajax, populate everything and make it visible

But here Im not sure about the loading speed because i have a lot on uneccessary elements on my page.

Method 2

  • Prepare forms on seperate php files and load them via jQuery into the right place.

    $ .ajax({

        url: "wp-content/themes/childtheme/some.php",     type: 'post',     dataType: "html",     async: true,     success: function(result){          $  ("#content-target").html(result);     }, }) 

This seems to work, but its always statet, that Ajax calls should go over the admin_url(‘admin-ajax.php’) url. But then im not sure, what to return from the php function (in admin-ajax)

But im also wondering if php code on the target file going to be executed?

Method 3

  • Prepare forms on seperate php files and also load them via jQuery but via admin-ajax.php

This was the only solution which comes in my mind when i try to do this over the admin-url.

Then i would’ve a php code like this which is returning my file:

function jd_include_myaccount_content() { $  pagename = $  _POST['pagename']; ob_start(); $  target_file = ABSPATH . 'wp-content\themes\flatsome-child\woocommerce\myaccount\orders.php' ; require($  target_file); $  buffer = ob_get_clean(); return $  buffer; 

}

and JS:

$ (‘.account-link’).on(‘click’, function() { var name = $ (this).data(‘pagename’); $ .ajax({

        url: <?php echo(admin_url('admin-ajax.php')); ?>,         type: 'post',         dataType: "html",         async: true,         data: {           action: 'jd_include_myaccount_content',           'pagename': name         },         success: function(result){              $  ("#content-target").html(result);         }     })   }) 

But here i only get an internal server error. Not sure if this is possible this way.

Does someone know which of the approaches should be the best ones Im really confused?

why is my wordpress not loading any images?

I have installed wordpress on google compute engine..

Running nginx, wordpress and https.. The site doesn’t load the admin panel or the images..

throws up 404 error on chrome inspection

HTTP404: NOT FOUND – The server has not found anything matching the requested URI (Uniform Resource Identifier). GET – https://fadingfernphotography.ca/api/wordpress/wp-content/uploads/2020/01/blog-1-1568×1046.png

HTTP404: NOT FOUND – The server has not found anything matching the requested URI (Uniform Resource Identifier). GET – https://fadingfernphotography.ca/api/wordpress/wp-content/uploads/2020/01/Blog-1-1568×1263.png