Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

KA-Creative on "Need help with Javascript and html for an onclick event"

$
0
0

Hi, am I trying to add an onclick fucntion to this page, http://new.healthcatalystcapital.com/team so that when a visitor clicks on one of the 4 team headers (Investment Team, Advisors, Management Team and Fund Admins) that the active section shows the team header in black. As of right now, I have all headers as grey and they turn black on the hover, but it won't stay black on active. I have the following javascript on the page already. Anyone know how to adjust so I can get this function working properly? Thanks in advance for your help!

<script type="text/javascript">// <![CDATA[
function OpenDiv(id){
for (i=1;i<=100;i++) { /* so you can add up to 100 options on each page */ var divname = 'div'+i; var divStyle = document.getElementById(divname).style; document.getElementById(divname).style.color = "black"; divStyle.display=(id==divname)?'block':'none'; } return false; }
// ]]></script>

<h2 style="text-align: center;">Investment Team | Advisors | Management Team | Fund Admins</h2>


4michaelcoleman on "Multiple CPT in same directory"

$
0
0

Trying to build an event segment where there is the main event page, speakers page, and sponsors page. How do I go about publishing all the pages (posts) into the same directory. Structure of what I am trying to do below.

/event-name/ - main event page
/event-name/speakers - a listing of speakers for the event
/event-name/sponsors - a listing of sponsors by level for the event.

Thanks in advance,

Michael

sinemac on "How to write query for multisite use"

$
0
0

I'm trying to create a plugin for use on our multisite install, but I can't quite figure out how to the db query in a way that will automatically get data from the correct subsite's db tables.

Here's a query that works:

$reportList = $wpdb->get_results($wpdb->prepare("SELECT wp_2_watupro_taken_exams.ID,
wp_2_watupro_taken_exams.exam_id,
wp_2_watupro_taken_exams.user_id,
wp_2_watupro_taken_exams.end_time 'completed',
wp_2_watupro_master.name 'assessment',
wp_users.display_name 'name',
wp_users.user_email 'email'
FROM wp_2_watupro_taken_exams
JOIN wp_2_watupro_master ON wp_2_watupro_master.ID = wp_2_watupro_taken_exams.exam_id
JOIN wp_users ON wp_users.ID = wp_2_watupro_taken_exams.user_id
WHERE wp_users.user_email LIKE '%".$_POST['client']."%'
ORDER BY wp_users.display_name;"));

I want to make it so that I don't have the "wp_2_" in there -- i.e., so that it will just automatically get the results based on the right prefix for the current site.

I've done a bunch of searching and reading, and here's what I've got (which doesn't work):

$reportList = $wpdb->get_results($wpdb->prepare("SELECT $wpdb->watupro_taken_exams.ID,
$wpdb->watupro_taken_exams.exam_id,
$wpdb->watupro_taken_exams.user_id,
$wpdb->watupro_taken_exams.end_time 'completed',
$wpdb->watupro_master.name 'assessment',
$wpdb->users.display_name 'name',
$wpdb->users.user_email 'email'
FROM $wpdb->watupro_taken_exams
JOIN $wpdb->watupro_master ON $wpdb->watupro_master.ID = $wpdb->watupro_taken_exams.exam_id
JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->watupro_taken_exams.user_id
WHERE $wpdb->users.user_email LIKE '%".$_POST['client']."%'
ORDER BY $wpdb->users.display_name;"));

So, the question is - where have I gone wrong?

MaWe4585 on "how to begin plugin-development"

$
0
0

hi there!

i already read throug beginner guides for plugin development so i know a few basics.
now i would like to do it a little more professional.
so first thing before i start is to ask people who already know things.

what i want:
- maintainable code
- separate user-interface from logic
- don't change the theme (want be able to install updates without losing my changes)

so in my plugin i'll have several entities, for example countries, towns, persons and homes.
some of them i could manage with custom-post-types(countries, towns, persons) and fill them with meta-data.
others i think i can't manage with custom post types (homes) there i think i would need to create a custom table and add the fields i need to store.

so when i have these i would create the views for the front-end.
one that lists all countries and let's me filter them and the same for towns and persons.
one for a country where i would like to see all information about the country as well as a list off all the towns in the country.
similar views for towns and persons as well.

now the question is: how would i create these views. i would like to separate it from the logic by using a template engine like smarty or twig.

can you provide me with an example of a plugin that works like this?

georgewaterman on "maximum number of post on homepage"

$
0
0

I have a site that I've been working on. The homepage is a template from Themler. I'm trying to get the homepage to only show the 4 most recent posts and the blog page show whatever I choose to set in the Reading section of settings.

Here's the code I found for the blog_4.php it's pulling it from. I did find the is_home section and I'm assuming it needs to go in there.

start code ______________________

<?php
function theme_blog_4() {
global $post;
$need_reset_query = false;
if (is_page()) {
$page_id = get_queried_object_id();
if (theme_get_meta_option($page_id, 'theme_show_categories')) {
$need_reset_query = true;
query_posts(
wp_parse_args(
'category_name=' . theme_get_meta_option($page_id, 'theme_categories'),
array(
'paged' => get_query_var('paged', get_query_var('page', 1))
)
)
);
}
}

if (!$need_reset_query && theme_is_preview()) {
global $theme_current_template_info;
if (isset($theme_current_template_info)) {
$template_name = $theme_current_template_info['name'];
$ids = theme_get_option('theme_template_' . $template_name . '_query_ids');
if ($ids) {
$need_reset_query = true;
$ids = explode(',', $ids);

query_posts(array(
'post_type' => 'any',
'post__in' => $ids,
'paged' => get_query_var('paged', get_query_var('page', 1)),
));
}
}
}
?>
<div class=" bd-blog-4">

<?php
if ( is_home() && 'page' == get_option('show_on_front') && get_option('page_for_posts') ){
$blog_page_id = (int)get_option('page_for_posts');
$title = '' . get_the_title($blog_page_id) . '';
echo '<h2 class=" bd-container-23 bd-tagstyles bd-custom-blockquotes bd-bootstrap-btn bd-btn-warning">' . $title . '</h2>';
}
?>

<?php
if (have_posts()) { ?>
<div class=" bd-grid-7">
<div class="container-fluid">
<div class="separated-grid row">
<?php while (have_posts()) {
the_post();

$id = theme_get_post_id();
$class = theme_get_post_class();
?>

<div class="separated-item-24 col-md-6 ">

<div class="bd-griditem-24">
<article id="<?php echo $id; ?>" class=" bd-article-5 clearfix <?php echo $class; ?>">
<?php
if (!is_page() || theme_get_meta_option($post->ID, 'theme_show_page_title')) {
$title = get_the_title();
if(!is_singular()) {
$title = sprintf('%s', get_permalink($post->ID), strip_tags($title), $title);;
}
if (!theme_is_empty_html($title)) {
?>
<h2 class=" bd-postheader-5">
<div class="bd-container-inner">
<?php echo $title; ?>
</div>
</h2>
<?php
}
}
?>

<?php echo theme_get_post_thumbnail(array('imageClass' => ' bd-imagestyles-17', 'class' => ' bd-postimage-4')); ?>

<?php
if (theme_is_preview() && is_singular()) {
$editor_attrs = 'data-editable-id="post-' . theme_get_the_ID() . '"';
} else {
$editor_attrs = '';
}
?>
<div class=" bd-postcontent-9 bd-tagstyles bd-custom-blockquotes bd-bootstrap-btn bd-btn-warning <?php if (theme_is_preview()) echo ' bd-post-id-' . theme_get_the_ID(); ?>">
<div class="bd-container-inner" <?php echo $editor_attrs; ?>>
<?php echo(is_singular() ? theme_get_content() : theme_get_excerpt()); ?>
</div>
</div>
</article>
<?php
global $withcomments;
if (is_singular() || $withcomments){ ?>
<?php
if (theme_get_option('theme_allow_comments')) {
comments_template('/comments_4.php');
}
?>
<?php } ?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
} else {
?>
<div class="bd-container-inner"><?php theme_404_content(); ?></div>
<?php
}
?>

</div>
<?php
if($need_reset_query){
wp_reset_query();
}
}

______________ end code

marciecarelock on "Taking apart Eventbuilder byThemedojo. Taking out what I don't need."

$
0
0

I bought the Eventbuilder Theme after playing with it for about a month. I really am getting nowhere gutting this code to add and remove what I need it to do.

For starters, adding events and places one at a time from the built in form is not ideal. I have a sql database of 250 locations and corresponding websites, social links, and lat log for geomap that need to be entered. I can't understand how the form is being stored then used for the information page, the map, and becoming searchable. I use phpmyadmin and mysql through hostgator to store the database. I've gone over the .php of upload-single-event, the variables aren't accessing any table I can see.

[Premium Theme code removed]

dwasisto on "Contact Form 7 Checkbox/Label Issue"

$
0
0

After researching some of the known issues with Contact Form 7, I'm finding that some are acceptable, Contact Form 7 works great for me, except that, for some stylesheet - it may cause some error on the WordPress site I'm currently building.

I've noticed with Contact Form 7's check-boxes or radio buttons will not appear next to the label, but instead in bottom or top, i.e. http://kangen.aripeach.com/index.php/contact/

I would like the check-boxes to line up horizontally, three on a line like in most of the example Contact 7 pages. Unfortunately, no matter how much i tried, it just won't appear as it should. Is this may be related with any stylesheet issue? Can someone please shed some light and help me out?

Can someone help me troubleshoot and how I would fix this?

Thanks for your help!

ianhuang2108 on "i am hacked!"


joyner.cn on "Developing different page listings for each category?"

$
0
0

I'm developing a site that I'd like to have different styles of listing different categories. So, my plan is to simply have a statement in entry.php that redirects to the entry file for the proper category.

I'm doing this:

<?php
	echo 'Home';

	if(in_category('people'))
	{
		include(TEMPLATEPATH.'/includes/entry-people.php');
	}
	else if(in_category('projects'))
	{
		include(TEMPLATEPATH.'/includes/entry-projects.php');
	}
	else if(in_category('blog'))
	{
		include(TEMPLATEPATH.'/includes/entry-blog.php');
	}
	else if(in_category('media'))
	{
		include(TEMPLATEPATH.'/includes/entry-media.php');
	}
	else if(in_category('news'))
	{
		include(TEMPLATEPATH.'/includes/entry-news.php');
	}
	else if(in_category('publications'))
	{
		include(TEMPLATEPATH.'/includes/entry-publications.php');
	}
	else
	{
		include(TEMPLATEPATH.'/includes/entry-default.php');
	}
?>

However, the other pages don't seem to load. How many things am I doing wrong? I've verified that the if statements are correctly triggering for each category, and that the path included in the include statement is indeed the right path to the file.

Chuck Smith on "Repossitory Update"

$
0
0

I have created my first plugin and followed the SVN direction to fix a bug and tagged a new version (v 0.3.1). It has yet to update on the plugin page. How long does it take? When I go to the admin page and browse the correct tag is listed, but the downloadable zip is not.

Plugin: https://wordpress.org/plugins/genesis-sermons-cpt/

snor512 on "How to add a css class style atribute to links generated from wp_get_archives?"

$
0
0

For one wordpress custom theme what i am developing,

What do i have to do in order to get: <a class="archive_link" href...> instead of: <a href...>

from the wp_get_archives function for an aside widget?

In functions.php i have this:

function sxo_widgets_init() {
    register_sidebar( array(
        'name' => __( 'Primary Widget Area', 'sabercomer' ),
        'id' => 'sidebar-1',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget' => '</aside>',
        'before_title' => '<h1 class="widget-title">',
        'after_title' => '</h1>'
    ) );
}
add_action( 'widgets_init', 'sxo_widgets_init' );

And in aside.php template i have:

...
<ul>
    <?php wp_get_archives( array( 'type' => 'monthly') ); ?>
</ul>
...

Thanks in advance!

jsjs on "WordPress add_rewrite_rule problems when rewriting to startpage"

$
0
0

Hi,

I do a custom wordpress rewrite with the following code:

function add_rewrite_rules() {
    	add_rewrite_rule(
      		'^mypath/([A-z0-9\-\_\,]+)/?$',
      		'index.php?page_id=2&tags=$matches[0]',
      		'top'
      	);
    }
    add_action('init', 'add_rewrite_rules');

This works fine:
When I open /mypath/tag1,tag2,tag3/ the page with the page_id==2 is shown, and GET parameter tags contains tag1,tag2,tag3.
The path stays /mypath/tag1,tag2,tag3/

But there is one exception: When the page with the page_id==2 is marked as the wordpress startpage, then he forgets everything and redirects to /

Wordpress seems to redirect to WP_HOME, if the page is the startpage, but I want it to stay on /mypath/tag1,tag2,tag3/, because I want to load my startpage and use the tags parameter in an angular script.

Does somebody have an idea how I can prevent this redirect?

herculesnetwork on "how to write the output of this function in field 'tags' on post-edit"

$
0
0

how to write the output of this function in field 'tags' on post-edit the dasboard the worpress?

$input = array("neo", "Morpheus", "Trinity", "Cypher", "Tank");
$rand_keys = array_rand($input, 2);
$mixnames = $input[$rand_keys[1]];

Thanks to all.

knorssman on "first plugin - how to let admin enter data and display data for users"

$
0
0

I am creating my first plugin, which in a nutshell i need it to create a database, let the admin of the website using the plugin enter data into the database, then display some of that data for visitors to the website

i have found out how to make custom database tables with $wpdb but i don't understand how to display the data for users and how to let the website admin enter data

thanks for any feedback

markverduffelt on "cookies in wordpress"

$
0
0

I know that i Can make a cookie with the function bellow,but how can i change the value of this cookie in the same page?

if i add the add_action command in a function,it don't work.

add_action( 'init', 'setting_my_first_cookie' );

add_action( 'init', 'setting_my_first_cookie' );

function setting_my_first_cookie($getal) {

setcookie( "counter", $getal, 60*60*24*90);
}


nickp8020 on "First CPT - Basic Question"

$
0
0

In my very first CPT plugin, I tried

add_filter('the_content', 'my_fun');

and

function my_fun($content){
print_r($content); // Returns blank ???
}

Should $content be blank? Doesn't it suppose to return data like get_page( $page_id );

adzter on "Implementation of One-Time Payment with Subscription Scheme"

$
0
0

Hello everyone, I have a problem using this plugin. Here's the link:

https://github.com/Prospress/woocommerce-subscribe-to-all-the-things

The plugin provides a feature to choose a one-time payment and subscription schemes on the cart. All my products are on simple product type. My problem using this plugin is that the Addons doesn't add on the initial price when choosing a subscription. For example, I set the product price to 30$, the monthly subscription to $95, and I choose to pay on a subscription basis. And then I checked the tick mark of the Addon for $295. Well, I'm expecting that the total checkout price is $420 with $95 monthly subscription price. Can someone help me tweak or if you have any recommendations of the same plugin?

Dotan Cohen on "Why are wp_terms and wp_termtaxonomy separate tables?"

$
0
0

It seems to me that Wordpress does not support putting a term into multiple taxonomies. Therefore, why are wp_terms and wp_termtaxonomy separate tables?

gabrielobinna4 on "Mobile site redirects to spam sites"

$
0
0

Good day,
When I visit my url on mobile device gabrielobinna.com it automatically redirects to spam sites. Please how do I rectify such.

Thanks

daveetasac on "Need to include custom fields in meta box select menu output"

$
0
0

Hello,

I've created a site to allow businesses to showcase their stores and associated coupons. In the front-end, they can select from a list of stores they've created, and can even see the address of each location in the dropdown as well. In the back-end, however, I can only view their name from the theme's custom post type meta box. This is a problem for me in case I need to update something, mainly because there might be multiple stores with the same name, and I have no to see which exact store is being referenced.

I'm using ACF Plugin for the custom fields.

Here's the code that works in the front end:

<select name="offer_store" id="offer_store" class="form-control" data-validation="conditional" data-conditional-field="offer_new_store" data-error="<?php esc_attr_e( 'Select the store this coupon is valid for', 'couponxl' ); ?>">
			        	<option value=""><?php _e( 'Select the store this coupon is valid for...', 'couponxl' ) ?></option>
				        <?php

						$stores = couponxl_get_custom_list( 'store', array(
							'author' => $current_user->ID,
							'orderby' => 'title',
				        	'order' => 'ASC',
							'posts_per_page' => '-1',
				        ) );

				        if( !empty( $stores ) ){
				        	foreach( $stores as $store_key => $store_name ){
								$address = get_field( "store_address_1", $store_key );
								$city = get_field( "store_city", $store_key );
								$state = get_field( "store_state", $store_key );
				        		echo '<option value="'.$store_key.'">'.$store_name.'&nbsp;&nbsp;( '.$address.',&nbsp&nbsp;'.$city.',&nbsp;&nbsp;'.$state.' )'.'</option>';
				        	}
				        }
				        ?>
			        </select>

I'm not sure how to insert the above code into the array below; I'm trying to show the address info next to the store name:

array(
			'id' => 'offer_store',
			'name' => __( 'Offer Store', 'couponxl' ),
			'type' => 'select',
			'options' => couponxl_get_custom_list( 'store', array(), 'title' ),
			'desc' => __( 'Select store of the offer.', 'couponxl' )
		),

Thanks in advance.

Viewing all 8245 articles
Browse latest View live




Latest Images