query_posts and only show results if a custom field is not empty

How do I query_posts and only show results if a custom field is not empty or has a value. I want to put in a URL in a custom field and only show these pages if there is a URL? current code but I can't figure out the rest: $args = array( 'posts_per_page' => '10', 'post_type' => 'programmes', 'orderby' => 'meta_value_num', 'meta_key' => 'popularityfig', 'order' => 'DESC', );
Category: Web

Additional navigation bar in header

Recently, my site started showing two navigation bars at the top of my page. They are also the wrong layout. I am fairly new to WordPress. I have only designed five websites so far. This is the first time I have encountered this issue. I am editing through Elementor Pro, and this does not show up when I preview the page, but it shows up when you enter into the website itself. How can this be fixed?
Category: Web

using wp_insert_term to create custom terms for a custom taxonomy from frontend form,

I have a form which allows certain roles to add custom terms to a taxonomy. My taxonomy is called Genre (slug genre) <form method='post' enctype='multipart/form-data'> <input type="text" value="" name="new"> <input type='submit' name='Save'> </form> I have been going around in circles with this for hours. Ive searched for other questions similar and have tried the suggestions. I am using https://wordpress.org/plugins/custom-post-type-ui/ to create the custom taxonomies - Was wondering maybe my script is firing before this plugin does and therefore wp_insert_terms happens …
Category: Web

Post and page content not displaying in search results

I am using a content-search.php template part to output my search results. The post/page titles and links to those posts/pages are working correctly, but for some reason the the_content() function is not rendering any HTML. I have tested for errors with debugging on, but nothing is displayed. Here is my content-search.php template code: <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?> </header><!-- .entry-header --> <div …
Category: Web

Which machine learning technique can be used for predictive log analysis

I have log data with 100k records. And These parameters. It looks like this. message types can be helpful for anomaly type detection. Out of total 15 message 5 message considered as anomaly. e.g. invalid user, connection closed by invalid user. Option 1 - Text classification model Create a classification model using text message, where it classifies the record based on message text. But I want to to use predictive analytics using date/time parameters so that it can help for …
Category: Data Science

How much potassium metabisulfite/Potassium Sorbate to stop fermentation?

I've had a lot of trouble finding a quick and easy answer to this question. Wine makers will add these chemical to wine after fermentation to prevent spoilage, and as an antioxidant. You can also add these two ingredients in mead, cider, wine, and beer to stop fermentation in order to hit a final gravity, or back sweeten. Without the use of a SO2 meter, what is a good approximation of how much potassium metabisulfite/Potassium Sorbate I should add to …
Category: Mac

How does electrical conductivity of a fermenting liquid change over time?

Has anyone ever measured how the conductivity of fermenting liquids changes over time? I have a hypothesis that it does change over time, and that as the fermentation rates and stages change, so will the capacitance of the wort. Also, that one will see more capacitance change during early fermentation, but it will settle down to a steady value as fermentation dies down, flocculation occurs, etc. Why do I ask? I would like to digitally measure fermentation activity without directly …
Category: Mac

Validation loss not decreasing using dense layers altough training and validation data have the same distribution

I have a problem that I have great difficulties understanding the concept that leads to these results. I use a keras dense layer to map 13 input features to 3 output labels. During the training, the loss (RMSE) for the training data constantly decreases even after 2000 epochs. However, the loss for the validation data does not decrease any more after some 200 epochs as you can see in the figure. Now the thing that I don't understand at all …
Category: Data Science

Are there any graph embedding algorithms like this already?

I wrote an algorithm for generating node embeddings based on the graph's topology. Most of the explanation is done in the readme file and the examples. The question is: Am I reinventing the wheel? Does this approach have any practical advantages over existing solutions for embeddings generation? Yes, I'm aware there are many algorithms for this based on random walks, but this one is pure deterministic linear algebra and it is quite simple, from my perspective. In short, the algorithm …
Category: Data Science

Keras Callback to save all the values of each batch per epoch

I would like to gather all the values during training for each epoch. When using the fit function of tensorflow I only receive the last value after run through all batches. One of my ideas would be to use GradientTape for this but maybe there is a easier way to do so using a callback. Does anybody have an idea how to obtain the store the result for each batch?
Category: Data Science

Keras Binary Classification - Maximizing Recall

Let me start by saying my machine learning experience is... dangerous at this stage. I'm still a beginner. I have a binary classification data set of about 100 000 records. 10% of the records are positive and the rest obviously negative. Thus a highly skewed dataset. It is extremely important to maximize the positive (true positive) prediction accuracy (recall) at the expense of negative (true negative) prediction accuracy . Thus, I would rather have an overall 70% accuracy if positive …
Category: Data Science

How to redirect outgoing links via my own website

How can redirect outgoing links first to my own site? for example i got a recipe post and i got a outgoing link to another website this link is stored in a metafield $recipe_url = "https://recipes.com/applepie"; but in the post i dont want to href recipes.com i want my own link like: $displayed_url = "https://myownsite.com/redirect/recipe/123"; does someone know how to archive this in wordpress?
Topic: php Wordpress
Category: Web

Using full site editing, can I edit just one specific post / page to be unique?

Let's say I have a special news report post and I want it to have a unique title (so that on the archive page it has the original post title, but on the post page it has a different title that I can set) and maybe a different background color. Basically, what I'm trying to do is to deviate from the default single post template only for one specific post. Is this doable somehow? Or do I have to create …
Category: Web

User Without Email?

When creating a user in Wordpress an email address is required for that user. The website I'm working on requires that users remain anonymous (it's part of a research study) and I'd consider email to be an identifying piece of data. Users will be added manually, so email is not required to confirm accounts or prevent spam sign-ups. Am I going to have to provide a fake email address for each account, or is there a way to leave this …
Category: Web

Which F1-score is used for the semantic segmentation tasks?

I read some papers about state-of-the-art semantic segmentation models and in all of them, authors use for comparison F1-score metric, but they did not write whether they use the "micro" or "macro" version of it. Does anyone know which F1-score is used to describe the segmentation results and why it is so obvious that authors do not define it in papers? Sample papers: https://arxiv.org/pdf/1709.00201.pdf https://arxiv.org/pdf/1511.00561.pdf
Category: Data Science

Custom wp_trim_words() function not trimming right

I have this custom wp_trim_words() function set to give me excerpts of only 20 words, and for the most part, it works fine. Except for some reason, on posts that contain lists, it outputs way more than 20 words. (See the posts at the bottom of this page.) How can I fix this? I tried removing <ul>,<ol>,<li>, from the function insight_allowedtags() but that did nothing. Ideally, I'd like to make the custom excerpt output at least 20 words and end …
Category: Web

Mold or Floating Yeast?

There is floating debris in my mead—Is this a cause for concern? Some context: I fermented honey water with Red Star Premier Blanc wine yeast, nearly 4 weeks ago. Two weeks ago, I transferred the mead into another carboy for secondary fermentation, added in toasted oak chips, and a Campden tablet. 1 week ago, I removed the oak chips, and transferred the mead into a new carboy. The mead still has not cleared up, and I just noticed some floating …
Category: Mac

AJAX handler throws 400 (Bad request) - why?

I am trying to apply a "Load more posts" function to a post loop, but I am dealing with a 400 Bad request, when admin-ajax.php is referred to. The reference I used is this - https://rudrastyh.com/wordpress/load-more-posts-ajax.html Following function (in functions.php) is passing query parameters to javascript: function wordpress_my_load_more_scripts() { global $wp_query; wp_enqueue_script('jquery'); wp_register_script( 'my_loadmore', get_stylesheet_directory_uri() . '/myloadmore.js', array('jquery') ); wp_localize_script( 'my_loadmore', 'wordpress_loadmore_params', array( 'ajaxurl' => admin_url() . 'admin-ajax.php', 'posts' => json_encode( $wp_query->query_vars ), 'current_page' => get_query_var( 'paged' ) ? get_query_var('paged') …
Category: Web

How to build a unbiased predictive ML model when the record of the event is less compared to the total number of records?

I am trying to build a model that will predict the communication loss of a wireless device. For now I am using RandomForestClassifier along with Device and Location as the features. I am getting both the train score and test score as 99%. So I am pretty sure the model is giving biased result. One of the reason might be because the record of communication loss events are very less compared to the the record with no communication loss Some …
Category: Data Science

WordPress plugin executing code twice

I am building a WordPress plugin and am stuck on an unexpected problem where my plugin code is running twice. Please see my plugin code: /* Plugin Name: plugin name Plugin URI: Description: Descript Version: 1.0 Author: Author Author URI: License: GPLv2 or later */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } require_once(dirname(__FILE__) . '/lib/visit_stats.php'); Here is my visit_stats.php code: // Current wordpress user id $userid = 3; // Getting visit value …
Category: Web

Create a drop down list within an active page not nav menu

I am working for a client that has requested a drop down list for some categories within a page, i.e. click on the link and a list drops down to select the page you want to view. Everything I seem to be finding is telling me how to create the drop down in the nav bar, that is not what I need. Any help is greatly appreciated...
Category: Web

bias variance decomposition for classification problem

It is given that: MSE = bias$^2$ + variance I can see the mathematical relationship between MSE, bias, and variance. However, how do we understand the mathematical intuition of bias and variance for classification problems (we can't have MSE for classification tasks)? I would like some help with the intuition and in understanding the mathematical basis for bias and variance for classification problems. Any formula or derivation would be helpful.
Category: Data Science

PHP File_exist() not working - Checking if File Exist in WordPress Theme Directory

I am trying to check if a certain archive file template exists in the WP theme directory. This is my code, I am not sure what I am missing here. <?php $file_name = '/archive.php'; $base_template_dir = get_template_directory_uri(); $file_uri = $base_template_dir.$file_name; $file_uri = str_replace('http://', '', $file_uri); $file_uri = str_replace('https://', '', $file_uri); $file_uri = str_replace($_SERVER['HTTP_HOST'], '', $file_uri); if (file_exists($file_uri)) { echo 'File Found: '.$file_uri; } else { echo 'File Not Found: '.$file_uri; } ?>
Category: Web

How to combine recommended lists produced by two different models?

Suppose there are two algorithms that I use to generate recommendations for a user, the first one producing list A, the second one producing list B, both of length $k$. Is there a clever way of combining the two lists (to create a hybrid approach, so to say) into a final list C of the same length as A and B? I suppose that some scoring could be possible, but I'm not sure what to base the scores on. Another …
Category: Data Science

How to cancel the trash action inside wp_trash_post

I need to restrict the button "EMPTY TRASH" and make it delete only the posts only if the logged in user is the creator. I tried to use the wp_trash_post and i need to decide in the function if i need to continue to trash or not. How do i tell WordPress NOT to empty the trash from specific posts?
Category: Web

Trained CNN individually on multiple images to classify them, how can I now classify a related "set" of these images that correspond to one object?

I have a N object classification examples, each example consisting of a set M individual images of the object at different angles. I've trained M CNNs with the dataset of one particular image angle each and their corresponding label. (Thus I have M sets of model parameters I've discovered for each angle) Now given this information, what is a good approach to classifying a new single object based on it's set of M individual image angles? (i.e I can classify …
Category: Data Science

Where should I find electrolytic capacitor ageing data

I am trying to get a dataset of Electrolytic capacitors ageing and I am not being able to find one that shows the ripple current and the voltage in order to calculate its Equivalent Series Resistance (a nice parameter to check its degradation). I have look on the typical sites (kaggle, dataworld...) but I found none. May someone recomend me a site? Thank you!
Category: Data Science

Adding google fonts to WordPress theme

I am trying to add google fonts to a custom WordPress theme. Therefore I tried to enqueue selected three font faces at once to make it fast loading. So, I use the below codes to register and enqueue the same. wp_register_style('googlFonts', '//fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=DM+Serif+Display&family=La+Belle+Aurore&display=swap'); wp_enqueue_style('googlFonts'); When I search via source code I can only see the last font. Other fonts are not loading. Even I can't see the same complete URL in the source code. Below is what I saw from the …
Category: Web

Reduce rows in data frame when computing variable?

Would anyone have an idea as to how I can change this code so that I get to a data frame that only has one row per year? # Step 1. Weighted sum = Sum(sum of mean severity ratings * the repetition of each word near trauma) df_word <- df_word %>% # compute the product of mean sum ratings (AV,A,V) * lemma repetitions mutate(AV.prod=(AV.Mean.Sum*repet), A.prod=(A.Mean.Sum*repet), V.prod=(V.Mean.Sum.R*repet)) df_word <- df_word %>% # group by year and sum for each group (AV,A,V) …
Topic: r
Category: Data Science

Trying to use different image size to test my trained model

I have built my model using images which are all 512x384, I then exported the model through .pkl and am hosting it on Render, the UI is built on React App where the user will input their chosen image I am aware that I could resize the images, either on the client side when the user inputs the image, on the server side using python, or I could change my model to accept different image sizes, could anyone advise what …
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.