Child Theme Variables

You can make your function filterable: function brickAlign() { $a = “true”; return apply_filters( ‘brick_align’, $a ); } Then, in your child Theme, add a filter callback: function child_theme_filter_brick_align( $a ) { return ‘false’; } add_filter( ‘brick_align’, ‘child_theme_filter_brick_align’ ); Alternately, you could pass a parameter to your function: function brickAlign( $value=”true” ) { // Note: … Read more

Trying to get variables in hacked category dropdown

The dot . in your code is evaluated as string litral, and not concatenation. Meaning if $inpCnt was equal to 5 for example, php will search for name=”scrape[“.5.’][sponsors]’ id= and will fail to find it. You can either remove the dots while still using the double quotes: $sponsors = str_replace( “name=”scrape[“$inpCnt’][sponsors]’ id=”, “name=”scrape[“$inpCnt’][sponsors][]’ multiple=”multiple” size=”19″ … Read more

Use conditional logic for woocommerce variable product

Late to the party but here you go: <?php if( $product->is_type( ‘simple’ ) ){ // a simple product } elseif( $product->is_type( ‘variable’ ) ){ // a variable product } // If you need a Product object for the above: $product = new WC_Product( get_the_ID() ); Found it here: https://gist.github.com/patrickgilmour/9d4a28b4a2f0c1dcecbf and here https://wordpress.org/support/topic/condition-to-check-if-product-is-simple-or-variable. I’m glad this … Read more

Custom Post not working as expected

Ok, I solved it, maybe instead of asking I should drink 1 more coffe or sleep something more, anyway the solution is to move this part: $singcpost = of_get_option(‘custom_posts_name_s_n1’); $plurcpost = of_get_option(‘custom_posts_name_p_n1’); $desccpost = of_get_option(‘custom_posts_name_d_n1’); $imgcpost = of_get_option(‘custom_posts_name_i_n1’); After the opening function… Here is the corrected code: <?php /* IF 1 Start */ add_action( ‘init’, … Read more

How to append a query string to pagination?

Refer this: Paginate Codex I can see that you are using custom query so you put this below and outside the while loop <?php global $wp_query; $big = 999999999; // need an unlikely integer $args = array( ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => ‘?page=%#%’, ‘total’ => $wp_query->max_num_pages, ‘current’ … Read more

Global Variable vs Local Variable

As @Milo pointed out, when you use code in OP $post_types is undefined inside the function, so WordPress will act just like it was not there at all. However, that means you are using an undefined variable, and if turn WP_DEBUG on you’ll see a warning, and so you can notice you are doing something … Read more

How to pass a PHP $_GET variable and fetch/output it?

get_query_var() only works with the Core WP_Query object: Retrieve public query variable in the WP_Query class of the global $wp_query object. https://codex.wordpress.org/Function_Reference/get_query_var Your mistake is a simple PHP one: The key is foo, not bar. $foo = $_GET[‘foo’]; echo $foo; But please do not echo user supplied data to the page without sanitizing it.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)