Loading...

Follow WordPress Development Stack Exchange on Feedspot

Continue with Google
Continue with Facebook
Or

Valid


Im building a QnA site on wordpress, with comments providing for the answers to a question-post. Like justanswer for example, I want a discussion to ensue under the question-post, and then an option to secure/lock/paywall a comment containing the answer - the comment can also hold a file.

I have a custom post type for solutions on the site, and would just love for people to post solutions to their questions in that custom post, but these should display in place of comments ... so Im kind of thinking whtehr to upgrade comment template, or is there a nifty plugin? Or... basically, how can I provide the ability to use a custom post in place of, and manner of a comment. The custom post already has all the fields - so its best suited to hang in place of a comment under the question-post.

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

Currently, I can only get the post by user roles on specific sites. What I need is to have a query that will get the post from user role on other site.

Example Users:
Site A - user(admin site a, editor site a)
Site B - user(editor site b)
Site C - user(editor site c)

Site A - index list of posts

  • Post by admin site A
  • Post by editor site A

Site B - index list of posts

  • post by admin site A
  • post by editor Site B.

Site C - index list of posts

  • post by admin site A
  • post by editor Site C.

Help me on how to implement this. Thanks

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

I'm curious to know can I change the admin panel URL from mydomain.com/wp-admin/?page=my-plugin to mydomain.com/wp-admin/my-plugin.php

Thanks!

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

how to upload image in database and i dont konw how to display image in table can anyone help me please?

<?php
/**
 * Template Name: ICO New Page
 */
get_header(); ?>
<?php
require_once('/../../../../wp-config.php');
extract($_POST);
        if ( isset( $_POST['submit'] ) ){

 $file = addslashes(file_get_contents($_FILES["logo"]["tmp_name"])); //image name


$result=$wpdb->query("INSERT INTO ico_calendar (token_id, coin_name,logo,type,coin,start_date,end_date,description,link,comments) VALUES ('$token_id', '$coin_name','$file','$type','$coin','$start_date','$end_date','$description','$link','$comments')"  );

if($result)
{
      echo " Data inserted Successfully";
      }else
      {
            echo "Data insertion failed";
}
            }




?>  
<div >
<form action="" id="ico" method="post" enctype="multipart/form-data">

            <label for="token_id">Token ID:</label>
            <input type="text" name="token_id" id="token_id" value=""/>
        <label for="coin_name">Coin Name:</label>
            <input type="text" name="coin_name" id="coin_name" value="" />
             <label for="logo">Logo:</label>
            <input type="file" name="logo" id="logo" value="" />
             <label for="type">Type:</label>
            <input type="text" name="type" id="type" value="" />
             <label for="coin">Coin:</label>
            <input type="text" name="coin" id="coin" value="" />
             <label for="start_date">Start Date:</label>
            <input type="date" name="start_date" id="start_date" value="" />
             <label for="end_date">End Date:</label>
            <input type="date" name="end_date" id="end_date" value="" />
            <label for="description">Description:</label>
            <input type="text" name="description" id="description" value="" />
            <label for="link">Link:</label>
            <input type="text" name="link" id="link" value="" />
            <label for="comments">Comments:</label>
            <input type="textarea" name="comments" id="comments" value="" />      
            <button type="submit" name="submit">Submit</button>


</form>
</div>

<?php get_footer(); ?>
Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I am customizing the category page. The final result should be, that when I go to category page, some products from a specific subcategory are not shown.

Example:

Category A
   Category A1
   Category A2
   Category A3

When I open Category A page, I want to hide products from Category A3. This has already been done by myself.

The problem: The pagination on the bottom (page numbers) still show normaly. They should be based on (number of products - number of filtered products).

See here (I am hiding products from Zubehor category):

https://shop.lx-avionik.de/product-category/funk-und-transponder/becker-avionics/

How can I fix this?

This is how I filtered the products in category.php:

    if ( have_posts() ) {
        do_action( 'woocommerce_before_shop_loop' );
        woocommerce_product_loop_start();

        if ( wc_get_loop_prop( 'total' ) ) {

            while ( have_posts() ) {                        
                the_post();

                // here I filter the products from specific category
                global $post;
                $skip = false;
                $terms = wp_get_post_terms( $post->ID, 'product_cat' );
                foreach ( $terms as $term ) {
                    if(substr( $term->slug, 0, 7 ) === "zubehor") {
                        $skip = true;
                        break;
                    }
                }

                if($skip) 
                    continue;           

                do_action( 'woocommerce_shop_loop' );       
                wc_get_template_part( 'content', 'product' );
            }
        }

        woocommerce_product_loop_end();
        do_action( 'woocommerce_after_shop_loop' );
    }
Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Will Product Attribute Filter, Price Filter etc works in normal (non-archive) pages? I am trying to show products in slider and also need filter to work. Trying to mimic this Magento site: https://www.angara.com/rings

Please any help would be appreciated.

NB: Please don't suggest plugins like "WooCommerce Variation Swatches" as the Magento site is showing individual product in the each color-icon; not variations attributes.

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

thank you in advance for reading my question and I hope it isn't too broad.

Basically i'm working on project at the moment whereby I want to take automatic, monthly, recurring payments as part of a subscription service. Each client will be paying a fixed monthly fee that is completely unique to them.

I would like to do this via a client portal through which clients can log in, begin the subscription, manage payment methods, view invoices and, if necessary, cancel the service.

Here is an example scenario:

  1. Client and I discuss services required and monthly fee for said services.
  2. I create a client account and send them the log in details.
  3. Client logs in, agreed monthly fee is displayed alongside payment form.
  4. Payment is taken and an invoice is generated for the client.
  5. Every month thereafter the client will be automatically billed and an invoice will be added to their "dashboard" which they can access by logging in.

In essence I'm looking for recommendations with regards to how I could go about achieving this and what plugins would be required. I'm a reasonably competent(ish) developer so don't mind getting my hands dirty with a bit of code but if there is a simpler way to go about doing this with already available plugins I would prefer that route.

Thanks once again and I hope I've explained myself clearly enough!

Cheers, Alex

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

I have created multisite in WordPress by using following details:

I have created a virtual host on XAMPP server as named mysite.local.

In hosts file, the path is C:\Windows\System32\drivers\etc.

   # localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost
    127.0.0.1       mysite.local

In httpd-vhosts.conf file, the path is C:\xampp\apache\conf\extra.

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "C:\xampp\htdocs
    <Directory  "C:\xampp\htdocs">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName mysite.local
    DocumentRoot "C:\xampp\htdocs\mysite
    <Directory  "C:\xampp\htdocs\mysite">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

In the wp-config.php file, I have put.

define('WP_HOME','http://mysite.local/');
define('WP_SITEURL','http://mysite.local/');



define( 'WP_ALLOW_MULTISITE', true );

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'mysite.local');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

This is working fine.

Problem: When I try to use multi-site without Virtual host then it stops working.

ex: http://localhost/mysite/

Question: Is it mandatory to create virtual host or domain for multi-site in WordPress?

Thanks

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

I am looking to create a website where users can registers (using the Ultimate Member plug-in). I want to allow those users to be able to take a survey where they can store their answers for the admin to look at, and for them to be able to change/update the answers at a certain point in the future, if they wanted to do so. Is there an already existing polling/survey plugin out there that I can install and have it store the data to a database which can be locked down to the user who took the survey?

I'm kinda unsure about how to do this with WP, however, with a coding background, I do understand how this will work.

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

So, i'm trying to filter products with WP_Query when a select option is selected, i found some articles about that, but none of them were clear (at least for me) on what i want.

For now i'm trying to filter the most selled and better rated products in the category template, here's the code i have.

<form method="get">
  <select id="order" name="order">
    <option value="1" selected="selected">Most selled</option> 
    <option value="2">Better rated</option>
  </select>
</form>

<?php    

  $current_category = get_queried_object();

  if( isset( $_GET['order'] ) && $_GET['order'] ) {
  $value = (int)$_GET['order'];
  if ($value == 1) {
    $args = array(
      'post_type' => 'product',
      'meta_key' => 'total_sales',
      'orderby' => 'meta_value_num',
      'tax_query' => array(
          array(
              'taxonomy' => 'product_cat',
              'field'    => 'slug',
              'terms'    => $current_category,
          ),
      ),
    );
  }
  elseif ($value == 2) {
    $args = array(
      'post_type' => 'product',
      'meta_key' => '_wc_average_rating',
      'orderby' => 'meta_value_num',
      'tax_query' => array(
          array(
              'taxonomy' => 'product_cat',
              'field'    => 'slug',
              'terms'    => $current_category,
          ),
      ),
    );
  }
  }
  $query = new WP_Query( $args );
  if ( $query->have_posts() ) {
    while( $query->have_posts() ) : $query->the_post();

      get_template_part("templates/product-content-category");

    endwhile;
  } wp_reset_postdata();


?>

By default the most selled products option is selected and it should filter the products by that and when the user change the option it should change the query.

The problem is that i don't know exactly how i can achieve this, what javascript or jquery i have to write to make it work and if the logic of the php is right. I'll be grateful is someone helps me.

Read Full Article
Visit website

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 year
Free Preview