how to print the content of pages inside the front end area

i'm new to wordpress and i'm trying to create a website. i need display the content of the pages when corresponding menu items are clicked. my page.php contain <?php while ( have_posts() ) : the_post(); $page_data= $post->ID; if($page_data=='116') { ?> <center><b><h2>WELCOME TO THE CLINIC!!</h2></b></center> <?php } else{ ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php the_content(); } endwhile; ?> but my content is not displaying. title is showing properly. what is the mistake in the code? please help me.
Category: Web

ImageDataGenerator for multi task output in Keras using flow_from_directory

I am creating a multitask CNN model and I have two different classification properties (one with 10 classes, 2nd with 5 classes) and my directory structure looks like this: -Train - image1.jpg ... - imageN.jpg -Test - image1.jpg ... - imageN.jpg -Vald - image1.jpg ... - imageN.jpg And labels are in a csv file as propA, propB. So, a single image will have two classes, one from property A and one from property B. The model uses VGG16 : baseModel …
Category: Data Science

How to keep the plugin submenu open on viewing a custom version of users.php?

I have added to my-plugin submenu a custom view of the user list using users.php and a my_plugin_view argument to filter the request: add_submenu_page( "my-plugin", 'Subscribers', 'Subscribers', 'edit_users', 'users.php?my_plugin_view=subscribers' ); When /users.php?my_plugin_view=subscribers is open the admin sidebar toggle Users > All Users instead of My Plugin > Subscribers I have tried: if( isset($_GET['my_plugin_view']) ){ remove_submenu_page( 'users.php' ); } but this removes the All Users section from the sidebar and doesn't toggle the plugin menu as expected. How to keep the …
Category: Web

Is there a way to make the window in df.rolling dynamic depending on which row it is calculating for?

I have a dataset of stock prices, and I want to add a column of 52 week lows for each day, however for the rows which dont have 365 days above them I just want the column to have the rolling min using whatever amount of rows exist above. I was trying code like this, but this obviously doesnt work because its creating the column twice. for row in data.iterrows(): if row[0] < (data.index[0] + timedelta(days = 365)): data['52wkLow'] = …
Category: Data Science

get_categories only getting categories in the main language

I am trying to retrieve in the "content composer" the categories of projects based on the active language. But i only get the categories off the main language, never on the other. My code is: Category All $categories = get_categories('taxonomy=jw_portfolio_categories'); if(!empty($categories)){ foreach($categories as $cat){ ?><option value="<?php echo $cat->term_id; ?>"><?php echo $cat->name; ?></option><?php } } ?> </select> Any idea on how to get all the categories or the ones of the active language in the WP backoffice?
Category: Web

Change logo url based on WP user role

I want to be able to change the WordPress default logo url (not the logo image) based on the user role. The image/logo will remain the same, only the url will change. Any assistance or ideas will be greatly appreciated.
Category: Web

How to determine irrelevant data in binary classification?

Suppose I was looking at social media to find users' intents on trading stocks. I might have a binary classification model that predicted "buy" and "sell". However, it's obvious that most social media posts mentioning a company are not related to buying or selling its stock. Even if I was to look specifically at places in the Internet where the main topic of discussion is buying and selling stocks, there would be handfuls of posts that were in a sense …
Category: Data Science

SMTP Issues with Office 365

I'm having issues setting up SMTP for Office 365 using the Easy WP SMTP plugin. I keep getting the following vague error message. SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting I've looked through most of the Troubleshooting documentation and have had no luck. Please see the image below for the settings I'm using. It seems like other people have experienced the same issue with Office 365. Any ideas?
Topic: smtp Wordpress
Category: Web

Sourcing (discounted) products customers want

Goal: Generate a list of 100 products per vertical (e.g. fashion, electronics) that the teams should source, discount, and list on the website over a specific period. You may assume all customers are online only. My thinking so far: Predict the customers that will come to the website during the specific period (time series). Only 30-40% customers return YOY. Understand what they want (use search data, add to basket but didn't checkout etc). Potentially segment it further by looking at …
Category: Data Science

Category URL to use same string as Post URL Permalink

I want to set up my site to have the following permalink structure: /learn/%category%/%postname% So in the permalinks section of wordpress, I set that as the custom structure. The issue is, when I click on a category page it's just: /%category%/ (it's ends up being a /category/subcategory/ url). So I tried setting the category base on the permalinks setting page also to /learn/, but then I get a 404 when I go to a post's page. How do I make …
Category: Web

Difference between regret and pseudo-regret definitions in multi-armed bandits

I posted this question Cross Validated, but didn't get any answer. So I am posting it here too, as the question is very relevant to machine learning I am following the book Bandit Algorithms. In page 48, they introduces regret after $n$ rounds as $$ \mathbf{R} = n\mu^\star - \mathbb{E}\Bigg[\sum_{t=1}^n \mathbf{X}_t\Bigg] \tag{1} $$ In page 55, they also define pseudo-regret as $$ \bar{\mathbf{R}} = n\mu^\star - \sum_{t=1}^n \mu_{A_t} \tag{2} $$ In the paper Regret Analysis of Stochastic and ..., authors …
Category: Data Science

How to choose parametric regression model with two predictors

I have a response variable (depicted on the y-axis in the following plots), that I want to regress using two predictors. On each plot, one predictor is along the x-axis, the other is color-coded in the points. If I were using a single predictor, I would model the relationship between the first predictor and the response variable as an exponential: $$ y = a e^{-bx} + c $$ And the relationship with the second, using a quadratic relationship: $$y = …
Topic: regression
Category: Data Science

RandomizedSearchCV doesn't stop running

I'm trying to optimize the hyperparameters of my model using RandomizedSearchCV. However, it doesn't stop running even if I define few iterations. Someone could help me? The code I'm using is presented below: def build_classifier(optimizer, units, alpha, l1): model = tf.keras.Sequential() model.add(tf.keras.layers.LSTM(units, kernel_regularizer = regularizers.l1(l1 = l1), input_shape= (None, n_features), return_sequences = True)) model.add(tf.keras.layers.LSTM(units, kernel_regularizer = regularizers.l1(l1 = l1), return_sequences = True)) model.add(tf.keras.layers.LSTM(units, kernel_regularizer = regularizers.l1(l1 = l1), return_sequences = False)) model.add(tf.keras.layers.Dense(5)) model.compile(optimizer = optimizer, loss = 'mae') return model …
Category: Data Science

Naive Bayes Predict type = 'raw' returning NA

I have build a naive bayes model for text classification.It is predicting correctly.But it is returning 'NA' in prediction results if i put 'type = raw'.i have seen some results in stackoverflow to add some noise.when i do that i am getting all A category as 0's and all B category as 1's.How can i get correct probabilities in naive bayes? library('tm'); library('e1071'); library('SparseM'); Sample_data <- read.csv("products.csv"); traindata <- as.data.frame(Sample_data[1:60,c(1,2)]); testdata <- as.data.frame(Sample_data[61:80,c(1,2)]); trainvector <- as.vector(traindata$Description); testvector <- as.vector(testdata$Description); trainsource …
Category: Data Science

Unable to get all tags from specific categories

Page in question. I'm trying to use a WP_Query(); targeting specific categories and displaying all the tags used for posts within those categories. I noticed that some tags, like truffles aren't being included in the results even though that post is categorized as a recipe and it's other category, sweets, is also included in the category array. Any thoughts on what I'm doing wrong so as to get only some of the tags? Thanks! <ul class="tag-list"> <?php $query = new …
Category: Web

How can I view my site directly from WordPress dashboard?

Basically, I am using localhost through XAMPP, it has been 2 weeks since I started and and I had to reinstall XAMPP because I was having problems with ports. And now, I just started remaking my website again, using the port '3000' for apache and everything seemed to work fine until I can't even see the changed I have made from the wordpress dashboard or by just writing the domain name in the search bar, what is weird is that, …
Category: Web

Computing number of business days between start/end columns

I have two Dataframes facts: columns: data, start_date and end_date holidays: column: holiday_date What I want is a way to produce another Dataframe that has columns: data, start_date, end_date and num_holidays Where num_holidays is computed as: Number of days between start and end that are not weekends or holidays (as in the holidays table). The solution is here if we wanted to do this in PL/SQL. Crux is this part of code: --Calculate and return the number of workdays using …
Category: Data Science

How does add_option() function enable action hooks to fire right after actiavtion?

The documentation page says that the hook process performs an instant redirect after it fires. So, in order to do something right after the activation the page suggests using add_option like so, function my_plugin_activate() { add_option( 'Activated_Plugin', 'Plugin-Slug' ); /* activation code here */ } register_activation_hook( __FILE__, 'my_plugin_activate' ); function load_plugin() { if ( is_admin() && get_option( 'Activated_Plugin' ) == 'Plugin-Slug' ) { delete_option( 'Activated_Plugin' ); /* do stuff once right after activation */ // example: add_action( 'init', 'my_init_function' ); …
Category: Web

How to display only taxonomies of custom post type in a page?

I have created recipe as a custom post and types as a taxonomy. In that taxonomy I have created vegetables and fruits as fields and I have 5 posts in each fields, but I need to display only vegetables and fruits in the page? The below Query is what I currently use. It displays all posts. <?php $mypost = array( 'post_type' => 'recipe', ); $loop = new WP_Query( array( 'post_type' => 'recipe', 'posts_per_page' => 9 ) ); ?> Can anyone …
Category: Web

How to store subset of columns from a csv file?

I need to create a table in hive (or Impala) by reading from a csv file (named file.csv), the problem is that this csv file could have a different number of columns each time I read it. The only thing I am sure of is that it will always have three columns called A, B, and C. For example, the first csv I get could be (the first row is the header): ------------------------ | X | Y | A | …
Topic: hive pyspark sql
Category: Data Science

Predicting change of shapes/coordinates

I'm trying to find a way to predict/calculate how a shape (e.g. outline of a glacier) will change in the future—based on its history (previous shape) and additional factors (e.g. Δtemperature). In my example: I have the shape/coordinates of a glacier and an average temperature at 1970, 1985, 2000, 2015. How can I give an estimate on how that shape will look like in 2030, based on the previous shapes and a predicted temperature? The shapes would ideally come in …
Category: Data Science

Image classification model only predicting one class

I'm trying to build a deep learning model to predict image classes from the Kaggle competition. I'm using the Xception model as the top layers and then putting the last layer into a dense layer with the softmax output of 4. No matter what I try with the model, it only predicts one class, the first-class 'healthy', even on the training set which gets a high accuracy. The data set is imbalanced in the multiple_diseases class, but even when I …
Category: Data Science

Objective Functions in Twin Support Vector Machines

I'm reading paper Twin Support Vector Machines for Pattern Classification by Jayadeva et al. (2007). In that paper, the authors proposed using two non-parallel hyperplanes for classifying two classes. The objective function for learning one hyperplane is: $$ \underset{w^{(1)}, b^{(1)}, q}{\text{Min}} \frac{1}{2} (Aw^{(1)} + e_1 b^{(1)})^T (Aw^{(1)} + e_1 b^{(1)}) + c_1 e_2 q^T \\ \text{subject to} -(B w^{(1)} + e_2 b^{(1)}) + q \ge e_2, q \ge 0 $$ , where $A$ and $B$ are data points belong to …
Topic: svm
Category: Data Science

Get the selected posts IDs to use in bulk edit AJAX call

The WordPress codex for bulk_edit_custom_box, along with this bulk edit example use the following piece of JavaScript to create an array of selected post IDs to send with the AJAX call that updates the posts. $bulk_row.find( '#bulk-titles' ).children().each( function() { $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) ); }); The full code surrounding this snippet is below. My list tables have input fields for meta values, and the inline quick edit works successfully, but bulk edit fails. When …
Category: Web

Forecasting out of sample with Fourier terms as regressors

I'm trying to create a multivariate multi-step-ahead forecast using machine learning (weekly and yearly seasonality). I use some exogenous variables, including Fourier terms. I'm happy with the results of testing the model with in sample data, but now I want to go for production and make real forecasts on completely unseen data. While I can update the other regressors (variables) since they are dummy variables and related to time, I don't know how I will generate new Fourier terms for …
Topic: forecast
Category: Data Science

Get category slug and display it on a query_post

I just read "How to create option page for wordpress theme" in wp.tutsplus.com - I have a problem with getting categories . there is two parts to my question - Part A - Get category slug and display it In this tutorial there is a select option as follow : $options[] = array( "section" => "select_section", "id" => WPTUTS_SHORTNAME . "_select_input", "title" => __( 'Select (type one)', 'wptuts_textdomain' ), "desc" => __( 'A regular select form field', 'wptuts_textdomain' ), "type" …
Category: Web

How can I detect user's timezone?

I have a custom post type in wordpress. I am pulling various data from remote server with API and adding it as custom fields to this post type. Among them is date and time whose Timezone is Turkey. I'm saving this date as a custom field. But I want to implement Time Zone based on visitor's location while showing date in front-end. When I researched I realized that we cannot detect client-side Time Zone easily with PHP. I've looked at …
Category: Web

Display post title from WordPress excluding a string via API

Imagine you have custom post types - Users. There are fields for each user as the post title, description, image, and rules. All titles are names of the Users and all they have Mr. before the names. What is the correct way and how to display all these fields via API in another site(not WordPress) but for the titles to exclude/strip the string Mr.?
Category: Web

Change "published by"

https://i.stack.imgur.com/tHTdu.jpg At my blogg / news is this line is coming at a new post. I use norwegian as language and then I want to change the word I marked yellow. In english is "published by:" In norwegian is would be "publisert av:", but I want it to say "Written by:" or in norwegian "Skrevet av:" How can I fix that ?
Category: Web

Javascript code inside "<# #>" in core WordPress files .php

I found some interesting embeding JavaScript mix with HTML in WordPress php files, for instance: &lt;?php // Template for the Attachment Details two columns layout. ?&gt; &lt;script type=&quot;text/html&quot; id=&quot;tmpl-attachment-details-two-column&quot;&gt; &lt;div class=&quot;attachment-media-view {{ data.orientation }}&quot;&gt; &lt;h2 class=&quot;screen-reader-text&quot;&gt;&lt;?php _e( 'Attachment Preview' ); ?&gt;&lt;/h2&gt; &lt;div class=&quot;thumbnail thumbnail-{{ data.type }}&quot;&gt; &lt;# if ( data.uploading ) { #&gt; &lt;div class=&quot;media-progress-bar&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt; &lt;# } else if ( data.sizes &amp;&amp; data.sizes.large ) { #&gt; &lt;img class=&quot;details-image&quot; src=&quot;{{ data.sizes.large.url }}&quot; draggable=&quot;false&quot; alt=&quot;&quot; /&gt; &lt;# } else if ( data.sizes …
Category: Web

Parent User and Child User - relate users

I need to create a system in which I have 2 types of users: Company User (C) and Employee User (E). I need C to be able to register as many E as necessary and for C users to be able to publish articles that will only be visible to E users, children of C users. I figured it would be possible to do this with meta fields so I created the ACF DAD and CHILD field with Jet Engine …
Category: Web

Clarification on "predict the next character given the previous 100 characters"

I am studying Justin Johnson's lecture on RNNs Lecture recording: https://www.youtube.com/watch?v=dUzLD91Sj-o&amp;list=PL5-TkQAfAZFbzxjBHtzdVCWE0Zbhomg7r&amp;index=12&amp;t=3177s One of the examples is character level language modeling: predicting the next character given the previous characters. At 33:03 in the video linked above, Justin discusses training an RNN that processes the works of William Shakespeare and tries to predict the next character given the previous 100 characters. What does given the previous 100 characters mean? In the lecture slides Slides link: https://web.eecs.umich.edu/~justincj/slides/eecs498/498_FA2019_lecture12.pdf there are the following figures: It …
Category: Data Science

How to pass username in affiliate link in wordpress website

I need to pass current logged in user in wordpress website as SUBID in the affiliate link as follows. Affiliate link format is like below. https://affiliatenetwork.com/track?id=myuserid&amp;url=https://nike.com&amp;subid={subid} I want to pass current logged in user as a subid in above link. I have written below code in functions.php. if ( is_user_logged_in() ) { $userName = get_current_user_id(); } &lt;----Need code here to pass $userName as subid ( mentioned in above link).------&gt; Please help.
Category: Web

About

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